Forum: RSpec [Cucumber] cucumber command does not work in db transaction

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
F1e1789ff9e7fc3032fa6cf15382a1e8?d=identicon&s=25 Juanma Cervera (jmcervera)
on 2009-01-29 13:27
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
3c28deaff162aeda44f2e0bcdca1dacf?d=identicon&s=25 Joseph Wilk (josephwilk)
on 2009-01-29 13:59
(Received via mailing list)
Juanma Cervera wrote:
> 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
3c28deaff162aeda44f2e0bcdca1dacf?d=identicon&s=25 Joseph Wilk (josephwilk)
on 2009-01-29 14:00
(Received via mailing list)
Woops, sorry I meant:

@@@
Cucumber::Rails.use_transactional_fixtures
@@@
F1e1789ff9e7fc3032fa6cf15382a1e8?d=identicon&s=25 Juanma Cervera (jmcervera)
on 2009-01-29 15:54
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
F1e1789ff9e7fc3032fa6cf15382a1e8?d=identicon&s=25 Juanma Cervera (jmcervera)
on 2009-01-29 15:58
For now I am running this command (together)

rake db:test:prepare && cucumber -r features -l es
features/reservas/creacion_reserva.feature


Juanma
C694a032be7518a0d704318895f8fe1d?d=identicon&s=25 Ben Mabey (mabes)
on 2009-01-29 16:14
(Received via mailing list)
Juanma Cervera wrote:
> Joseph, thanks for the reply.
>
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
3c28deaff162aeda44f2e0bcdca1dacf?d=identicon&s=25 Joseph Wilk (josephwilk)
on 2009-01-29 16:28
(Received via mailing list)
Ben Mabey wrote:
>>
>>
>>
> 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-cucu...

--
Joseph Wilk
http://blog.josephwilk.net/
This topic is locked and can not be replied to.