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.
Juanma C. (Guest)
on 2009-01-29 14: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 C.
Joseph W. (Guest)
on 2009-01-29 14:59
(Received via mailing list)
Juanma C. wrote:
> Isn't it a bug or it's correct? and I have to delete my data each time
> when using cucumber command.
>
> Juanma C.
>
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 W.
http://blog.josephwilk.net
Joseph W. (Guest)
on 2009-01-29 15:00
(Received via mailing list)
Woops, sorry I meant:

@@@
Cucumber::Rails.use_transactional_fixtures
@@@
Juanma C. (Guest)
on 2009-01-29 16:54
Joseph W. 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 C.
Juanma C. (Guest)
on 2009-01-29 16:58
For now I am running this command (together)

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


Juanma
Ben M. (Guest)
on 2009-01-29 17:14
(Received via mailing list)
Juanma C. 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
Joseph W. (Guest)
on 2009-01-29 17:28
(Received via mailing list)
Ben M. 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 W.
http://blog.josephwilk.net/
This topic is locked and can not be replied to.