[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 C.

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.

Woops, sorry I meant:

@@@
Cucumber::Rails.use_transactional_fixtures
@@@

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. 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

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. 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-cucumber/tickets/181-background-runs-outside-of-transactions


Joseph W.