This repo contains a series of Ruby tests that illustrate common scenarios which can prevent specs from running effectively (or running at all).
These tests have been written with test-unit to make them lightweight and fast, but the principles can be applied to any test suite (such as minitest, cucumber, or rspec).
- Install
rbenv - Run
rbenv install 3.4to install the appropriate Ruby version - Clone this repo to a folder of your choice
- Inside that folder, run
rbenv local 3.4to set the local Ruby version - Run
bundle installto install needed dependencies - Optionally run
gem install parallel_tests(if you want to test parallelization)
Individual tests are split between two folders:
bad-testscontains broken or malformed testsgood-testscontains a corollary set of "fixed" tests with identical names
To run any test, simply invoke them as a ruby script from your terminal:
# Run the broken and fixed timezone tests:
ruby bad-tests/timezone.rb
ruby good-test/timezone.rb
# Run tests in a random order
ruby bad-tests/order.rb --order=r
ruby good-tests/order.rb --order=r
# Run multiple test files in parallel
parallel_test bad-tests/factories.rb bad-tests/seeds.rb
parallel_test good-tests/factories.rb good-tests/seeds.rb