Juanma Cervera
2009-Jan-29 12:27 UTC
[rspec-users] [Cucumber] cucumber command does not work in db transaction
I am working in an scenario and it''s still failing. I have not yet finished it. And I am running it constantly with the cucumber command, not with rake. The problem is that it''s not working with the database in a transaction, and I have to run ''rake db:test:prepare'' manually between two sequential runs of cucumber. rake features, make db:test:prepare automatically. But cucumber no. Isn''t it a bug or it''s correct? and I have to delete my data each time when using cucumber command. Juanma Cervera -- Posted via http://www.ruby-forum.com/.
Joseph Wilk
2009-Jan-29 12:50 UTC
[rspec-users] [Cucumber] cucumber command does not work in db transaction
Juanma Cervera wrote:> I am working in an scenario and it''s still failing. I have not yet > finished it. > > And I am running it constantly with the cucumber command, not with rake. > The problem is that it''s not working with the database in a transaction, > and I have to run ''rake db:test:prepare'' manually between two sequential > runs of cucumber. > > rake features, make db:test:prepare automatically. > But cucumber no. > Isn''t it a bug or it''s correct? and I have to delete my data each time > when using cucumber command. > > Juanma Cervera >Do you have: @@@ Cucumber::Rails.use_transactional_fixtures = true @@@ In your env.rb? If you are using a browser based testing tool such as Selenium or Watir you have to deal with the clean-up yourself (using Cucumber''s hooks: http://wiki.github.com/aslakhellesoy/cucumber/hooks). -- Joseph Wilk http://blog.josephwilk.net
Joseph Wilk
2009-Jan-29 12:52 UTC
[rspec-users] [Cucumber] cucumber command does not work in db transaction
Woops, sorry I meant: @@@ Cucumber::Rails.use_transactional_fixtures @@@ Joseph Wilk wrote:> Juanma Cervera wrote: >> I am working in an scenario and it''s still failing. I have not yet >> finished it. >> >> And I am running it constantly with the cucumber command, not with rake. >> The problem is that it''s not working with the database in a transaction, >> and I have to run ''rake db:test:prepare'' manually between two sequential >> runs of cucumber. >> >> rake features, make db:test:prepare automatically. >> But cucumber no. >> Isn''t it a bug or it''s correct? and I have to delete my data each time >> when using cucumber command. >> >> Juanma Cervera >> > Do you have: > > @@@ > Cucumber::Rails.use_transactional_fixtures = true > @@@ > > In your env.rb? > > If you are using a browser based testing tool such as Selenium or > Watir you have to deal with the clean-up yourself (using Cucumber''s > hooks: http://wiki.github.com/aslakhellesoy/cucumber/hooks). > > -- > Joseph Wilk > http://blog.josephwilk.net > >
Juanma Cervera
2009-Jan-29 14:54 UTC
[rspec-users] [Cucumber] cucumber command does not work in db transaction
Joseph Wilk wrote:> Woops, sorry I meant: > > @@@ > Cucumber::Rails.use_transactional_fixtures > @@@Joseph, thanks for the reply. I do have Cucumber::Rails.use_transactional_fixtures in env.rb I have verified it failing when setting the database in the new background section of the feature. In that case I have to call manually db:test:prepare to clean up the database. But it works like expected when I move the setup to the Scenario. Juanma Cervera -- Posted via http://www.ruby-forum.com/.
Juanma Cervera
2009-Jan-29 14:58 UTC
[rspec-users] [Cucumber] cucumber command does not work in db transaction
For now I am running this command (together) rake db:test:prepare && cucumber -r features -l es features/reservas/creacion_reserva.feature Juanma -- Posted via http://www.ruby-forum.com/.
Ben Mabey
2009-Jan-29 15:05 UTC
[rspec-users] [Cucumber] cucumber command does not work in db transaction
Juanma Cervera wrote:> Joseph Wilk wrote: > >> Woops, sorry I meant: >> >> @@@ >> Cucumber::Rails.use_transactional_fixtures >> @@@ >> > > > Joseph, thanks for the reply. > I do have Cucumber::Rails.use_transactional_fixtures in env.rb > > I have verified it failing when setting the database in the new > background section of the feature. > In that case I have to call manually db:test:prepare to clean up the > database. > But it works like expected when I move the setup to the Scenario. > > Juanma Cervera > >The transactions are setup to start and be rolled back for each scenario.. Depending on how the Background section was implemented its setup may not be included in this transaction... So it sounds like it may be a bug with the new feature. WDYT Joeseph? -Ben
Joseph Wilk
2009-Jan-29 15:21 UTC
[rspec-users] [Cucumber] cucumber command does not work in db transaction
Ben Mabey wrote:> Juanma Cervera wrote: >> Joseph Wilk wrote: >> >>> Woops, sorry I meant: >>> >>> @@@ >>> Cucumber::Rails.use_transactional_fixtures >>> @@@ >>> >> >> >> Joseph, thanks for the reply. >> I do have Cucumber::Rails.use_transactional_fixtures in env.rb >> >> I have verified it failing when setting the database in the new >> background section of the feature. >> In that case I have to call manually db:test:prepare to clean up the >> database. >> But it works like expected when I move the setup to the Scenario. >> >> Juanma Cervera >> >> > The transactions are setup to start and be rolled back for each > scenario.. Depending on how the Background section was implemented its > setup may not be included in this transaction... So it sounds like it > may be a bug with the new feature. > WDYT Joeseph? >*lightbulb* Yes this was me thinking it was really clever to run Background before any of you''re ''Before''s. Which would scupper transactions. Will look at this ASAP. Thanks for spotting this. You can track the ticket here: http://rspec.lighthouseapp.com/projects/16211-cucumber/tickets/181-background-runs-outside-of-transactions -- Joseph Wilk http://blog.josephwilk.net/> -Ben > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >