Yes, That's what I want to do, but my code is a little bit different. I'm calling config.use_transactional_fixtures inside the block:
config.before(:each) do config.use_transactional_fixtures = false end And then enabling it again after: config.after(:each) do DatabaseCleaner.clean #truncation mode doesn't require the start method to be called, so clean is enough. config.use_transactional_fixtures = true end Why? Well, not all example use js (culerity), and for those, I wouldn't want to use DatabaseCleaner. However, it doesn't seem to work. If I create an object from the ruby instance running the specs, and put a breakpoint, I can't see the data outside of it :( Any ideas? Marcelo. On Wed, Jun 16, 2010 at 1:47 PM, David Chelimsky <dchelim...@gmail.com>wrote: > On Jun 16, 2010, at 1:37 PM, Marcelo de Moraes Serpa wrote: > > Hi David, > > Yeah, I'm using DatabaseCleaner, pretty much familiar with it. > > The issue is that passing it to rspec's yielded config object didn't seem > to disable transactional_fixtures: > > 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 >> > > Check the lines "config.use_transactional_fixtures" on both callbacks. I > doesn't seem to disable them. Any ideas? > > > Not sure why that doesn't work, but that's not what I was proposing. I'm > saying use database cleaner _instead_ of config.use_transactional_fixtures: > > Spec::Runner.configure do |c| > c.use_transactional_fixtures = false > c.before do > if options[:js] > DatabaseCleaner.strategy = :truncation > else > DatabaseCleaner.strategy = :transaction > end > DatabaseCleaner.start > end > c.after do > DatabaseCleaner.clean > end > end > > Make sense? > > > Marcelo. > > > On Tue, Jun 15, 2010 at 5:32 PM, David Chelimsky <dchelim...@gmail.com>wrote: > >> 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 >> _______________________________________________ >> rspec-users mailing list >> rspec-users@rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> > > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users > > > > _______________________________________________ > rspec-users mailing list > rspec-users@rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
_______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users