[rspec-users] ordering dependency in tests?

Fearless Fool lists at ruby-forum.com
Thu Feb 24 12:55:18 EST 2011


I'm baffled.  If I do:

  $ bundle exec ruby  -S rspec --tty A_spec.rb
  $ bundle exec ruby  -S rspec --tty B_spec.rb

I get no errors.  But then if I do:

  $ bundle exec ruby  -S rspec --tty A_spec.rb B_spec.rb

I get an error on B_spec.  And if I reverse the order:

  $ bundle exec ruby  -S rspec --tty B_spec.rb A_spec.rb

I get an entirely different error on A_spec.  I swear that I'm not doing
any before(:all) anywhere, but clearly there's some state that is
persisting between the two spec files.  I've tried inserting
$stderr.puts() messages to gain some insight as to what's happening, but
they seem to be suppressed (is that expected?).

So: any ideas of gotchas to look out for?

In the meantime, I'm going to start commenting out blocks of tests in
A_spec and see when B_spec stops failing.

-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list