For users
This installs three major features:
-
a 'gem test' command.
-
the ability to test your gems on installation, and uninstall them if they fail testing.
-
A facility to upload your test results to rubygems.org (coming soon, see github.com/bluepojo/gem-testers)
.gemrc
You can insert several things in your .gemrc to make things simpler. These all live in the 'test_options' subsection, e.g.:
test_options: auto_test_on_install: true test_on_install: true install_development_dependencies: true test_development_dependencies: false upload_results: false force_install: false force_uninstall_on_failure: false
All options are false by default. For some of them, if the value is unknown or false, you will be prompted when it is required for testing.
The options:
auto_test_on_install |
runs the unit tests when 'gem install' is invoked. |
test_on_install |
offer to test on install in general. 'auto_test_on_install' overrides this. |
install_development_dependencies |
automatically install the development dependencies when testing. This is recommended. |
test_development_dependencies |
recursively test dev dependencies installed by rubygems-test. This can significantly increase the time it takes to install a gem. |
upload_results |
upload results to gem-testers.org. |
upload_service_url |
Set to a URL, it will upload to that service instead. |
force_install |
always install, even on test failures. |
force_uninstall_on_failure |
force uninstall when tests fail. |
For gem developers
Want your gem to be testable?
-
Create (and add to your files section in your specification!) a '.gemtest' empty file. This is what signals the rubygems-test engine to process your gem as testable.
-
Ensure 'rake test' works and doesn't wipe out filesystems, databases, etc. Move those tests to another task.
-
Be sure to include your Rakefile in your gem, along with your tests.
-
Be sure to note any development dependencies that will be required for executing your rakefile and your tests in your gemspec. They will be installed as a part of the testing process.
Note on Patches/Pull Requests
-
Fork the project.
-
Make your feature addition or bug fix.
-
Add tests for it. This is important so I don't break it in a future version unintentionally.
-
Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
-
Send me a pull request. Bonus points for topic branches.
Copyright
Copyright (c) 2010 Erik Hollensbe and Josiah Kiehl. See LICENSE for details.