[rspec-users] odd fixture behavior

Ben Mabey ben at benmabey.com
Tue Apr 29 18:47:48 EDT 2008


Hello all,
I am upgrading an older app from rails 1.2.3 to rails 2.0.2 and am 
upgrading rspec and rspec-on-rails to 1.1.3 in the process.
After upgrading I am getting some weird errors relating to fixtures.  
Most of the model example groups have fixtures declared at the top.  
What is odd is that I can run any given spec file individually with the 
spec command and they run just fine.  However, when I run all the specs 
with rake spec certain spec groups fail due to fixtures not being loaded 
properly.  Meaning, the DB should of been populated by the fixtures but 
in the specs the tables are empty.  I have ran './script/generate rspec' 
and in my spec_helper.rb I have:

Spec::Runner.configure do |config|
  config.use_transactional_fixtures = true
  config.use_instantiated_fixtures  = false

I know that rspec just relies on the test::unit fixture framework that 
rails provides so this isn't really a rspec issue but I'm hoping that 
someone on this list may have some ideas on what could be going wrong 
here.  Were there changes to the way fixtures worked in rails 2.0 that 
would effect how I am doing things?  I haven't used fixtures for ever 
(switched to a factory instead) so I haven't really kept up with there 
changes.... Any ideas on what could be wrong or how I could troubleshoot 
this problem would be greatly appreciated.  Thanks,

Ben


More information about the rspec-users mailing list