|
1 | 1 | # ghi |
2 | 2 |
|
| 3 | +[](https://travis-ci.org/shubhamshuklaer/ghi) |
| 4 | + |
3 | 5 | GitHub Issues on the command line. Use your `$EDITOR`, not your browser. |
4 | 6 |
|
5 | 7 | `ghi` was originally created by [Stephen Celis](https://github.com/stephencelis), and is now maintained by [Alex Chesters](https://github.com/alexchesters). |
@@ -69,3 +71,47 @@ FAQs can be found in the [wiki](https://github.com/stephencelis/ghi/wiki/FAQ) |
69 | 71 | ## Screenshot |
70 | 72 |
|
71 | 73 |  |
| 74 | + |
| 75 | +## Testing Guidlines |
| 76 | +* You are encouraged to add tests if you are adding new feature or solving some |
| 77 | +problem which do not have a test. |
| 78 | +* A test file should be named as `something_test.rb` and should be kept in the |
| 79 | +`test` folder. A test class should be named `Test_something` and a test |
| 80 | +function `test_something`. Helper functions must not start with `test`. |
| 81 | +* Before running tests `GITHUB_USER` and `GITHUB_PASSWORD` environment |
| 82 | +variables must be exported. It is best to use a fake account as a bug can mess |
| 83 | +up your original account. You can either export these 2 environment variables |
| 84 | +through `~/.bashrc`(As ghi only uses these while generating its token, so after |
| 85 | +you generate the token for your original account(for regular use), fake account |
| 86 | +details can be exported) or you can pass it on command line, eg. `rake |
| 87 | +test:one_by_one GITHUB_USER='abc' GITHUB_PASSWORD='xyz'`. |
| 88 | +* Run `rake test:one_by_one` to run all the tests |
| 89 | +* Check [Single Test](https://github.com/grosser/single_test) for better |
| 90 | +control over which test to run. Eg. `rake test:assign:un_assign` will run a |
| 91 | +test function matching `/un_assign/` in file `assign_test.rb`. One more eg. |
| 92 | +`rake test:edit test:assign` will run tests `edit_test.rb` and |
| 93 | +`assign_test.rb`. Or you can also use `ruby -I"lib:test" test/file_name.rb -n |
| 94 | +method_name` |
| 95 | +* By default, the repo and token created while testing will be deleted. But if |
| 96 | +you want to see the state of repo and tokens after the test has run, then add |
| 97 | +`NO_DELETE_REPO=1` and `NO_DELETE_TOKEN=1` to the command. For eg. `rake |
| 98 | +test:assign NO_DELETE_REPO=1 NO_DELETE_TOKEN=1`. |
| 99 | +* If you don't wanna run the tests locally use travis-ci. See section below. |
| 100 | + |
| 101 | +## Enable Travis CI in fork |
| 102 | + |
| 103 | +* Open a Travis CI account and activate travis-ci for the fork |
| 104 | +* Create a fake github account for testing. The username, password and token |
| 105 | +will be available to the tests and if by mistake the test prints it, it will be |
| 106 | +available in public log. So its best to create a fake account and use a |
| 107 | +password you are not using for anything else. Apart from security reasons, |
| 108 | +bugs in tests or software can also mess up your original account, so to be |
| 109 | +on safe side use a fake account. |
| 110 | +* At Travis-CI, on the settings page for the fork, add environment variables |
| 111 | +`GITHUB_USER` and `GITHUB_PASSWORD`. Ensure that the "Display value in build |
| 112 | +log" is set to false. It is possible to add these in ".travis.yml", but don't |
| 113 | +as all forks as well as original repo will be using different accounts(We cannot |
| 114 | +provide the details of a common account for testing because of security reasons) for |
| 115 | +testing, so it will cause problems during merge. |
| 116 | +* Note that the build status badge in the README points to the travis-ci page |
| 117 | +for this repo, not the fork. |
0 commit comments