Ruby MiniTests written to learn ruby and their most specific details, differences between versions and other curiosities
Includes version conditional code currently between version 1.8.x and 1.9.x
To run all the tests together use:
rake
or
rake test
or
rake test:digest
To run all tests separately use:
rake test:all
To run individual tests use:
rake test:<name>
replacing <name> by the name of the test file without the “test_” part and without the “.rb” extension Example:
rake test:arrays
To see which tests you can run use:
rake -T
Every file in the test folder corresponds to a test suite you can run, all the Rakefile does is gather all the files in this folder and generate a test task for each of them.
The lib folder contains base example classes used in the tests, these will grow as the tests will become more complex and complete.
If you write your own tests and need to create more files follow the pattern already in place ‘test_*.rb’ replacing * by the name of the test. This way the Rakefile will create new tasks automatically for them, or you can alter the Rakefile if you want.
This project can be found on GitHub at the following URL.
http://github.com/jasoares/ruby-learning-tests/
If you want to write your own tests, please fork this repository and grow your own…
Active development happens in the minitest branch, master branch is used to merge stable versions of the minitest branch. The unit-test is the old branch where all the original code was written previously to the change to to minitest.
The development branch minitest has shifted to use minitest instead of unit test, the old unit tests will not be further developed. If you are using ruby 1.9.x there’s nothing you need to do about it but if you are running ruby 1.8.x or a prior version you need to make sure you install the minitest gem.
The Gemfile included in the repo asks for version 2.11.3. It’s easy to install, just run:
bundle install
and you are done. If you are running ruby with rvm, you probably should run
rvm gemset create ruby-learning-tests rvm gemset use ruby-learning-tests
instead, to setup a new gemset for this project and then just
rvm gemset install minitest
or
bundle install
and you’re equally ready to go.