Unit tests should pass when run in random order. But for an existing legacy
project certain tests might depend on the execution order. One test might run
perfectly fine by itself, but fail miserably when run after another test.
Rather than running different combinations manually, RSpec 2.8 has the option
to run specs in random order with the --order random
flag. But even with
this it can be hard to determine which specific test is causing the
dependency. For example:
rspec spec/controllers # succeeds
rspec spec/lib/my_lib_spec.rb # succeeds