[rspec-users] rspec (steak) turning off transactional fixtures

David Chelimsky dchelimsky at gmail.com
Tue Jun 15 18:32:34 EDT 2010


On Jun 15, 2010, at 5:15 PM, Marcelo de Moraes Serpa wrote:

> Hey all,
> 
> I have replaced Cucumber with Steak and I like the experience so far. It is not as polished as Cucumber in what comes to configuration, but it is simpler and covers my needs perfectly. I've followed the trick to pass a hash to the example in order to setup Capybara to use a different driver, like so:
> 
> spec/acceptance/support/javascript.rb
> 
> Spec::Runner.configure do |config|
> 
>   config.before(:each) do
>     if options[:js] #using culerity
>       Capybara.current_driver = :culerity
>       config.use_transactional_fixtures = false
>     end
>   end
> 
>   config.after(:each) do
>     if  options[:js]
>       DatabaseCleaner.clean
>       Capybara.use_default_driver
>       config.use_transactional_fixtures = true
>     end
>   end
> 
> end
> 
> As you can see, if an example has an option with :js => true, it will use culerity, and this works fine. What doesn't seem to work is the use_transactional_fixtures = false conf. I still can't access the data outside of the ruby instance (i.e: the app server celerity is accessing doesn't have access to the fixture data). With Cucumber it would be a matter of setting up Cucumber::Rails::World.use_transactional_fixtures to false. 
> 
> How could I disable transactional fixtures on a per example base when using rspec / steak?

As far as I know, this is not easy, or maybe even possible, with the Rails built-in framework. What I'd do is turn off the rails features (config.use_transactional_fixtures = false) and use database_cleaner. Are you familiar w/ database_cleaner?

David


More information about the rspec-users mailing list