On Aug 10, 2011, at 4:53 PM, steven_noble wrote:

> I have a bunch of fixtures designed to populate the database for my Cucumber 
> integration tests.
> 
> But at this stage I want my database to be empty when using Rspec.
> 
> So, I moved the fixtures from `/spec/fixtures` to 
> `features/support/fixtures`, and updated `features/support/env.rb` to read:
> 
>     Fixtures.reset_cache  
>     fixtures_folder = File.join(RAILS_ROOT, 'features', 'support', 'fixtures')
>     fixtures = Dir[File.join(fixtures_folder, '*.yml')].map {|f| 
> File.basename(f, '.yml') }
>     Fixtures.create_fixtures(fixtures_folder, fixtures)
> 
> So far so good. Cucumber still loads the fixtures I moved as planned.
> 
> But Rspec is still loading them too! This is despite `spec/spec_helper.rb` 
> saying:
> 
>       config.fixture_path = "#{::Rails.root}/spec/fixtures"
> 
> I have tried setting the following in `spec/spec_helper.rb`: 
> 
>       config.use_transactional_fixtures = false

use_transactional_fixtures is a bit misleading: it's a hook from Rails that 
really means "run each example in a transaction." There is no way to globally 
turn fixtures on or off - you either declare fixtures (in which case the 
underlying framework will go look for them) or not (in which case it won't).

> However, it doesn't work. And it wouldn't be a long-term solution anyway, as 
> I may need fixtures in Rspec in the future.
> 
> How can I fix this?

How are you running rspec and cucumber?

_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to