Transactional database cleaning not working

77 views
Skip to first unread message

Stewart

unread,
Oct 12, 2010, 7:10:36 AM10/12/10
to Cukes
Hello,

I am currently attempting to test a rails3 application with the
selenium. I have written my first test and it works fine however my
second test fails. I get an error when a user signs up saying the
email address is already taken. This suggests to me that the database
is not clean when running the second test.

I investigated and found that that i need to set
Cucumber::Rails::World.use_transactional_fixtures = false which i have
in my support/env.rb and that the features have the correct tag on
them in this case its "@selenium". From the source at
http://github.com/aslakhellesoy/cucumber-rails/blob/master/lib/cucumber/rails/active_record.rb
I am assuming that this is handled automatically however when I look
at my test.log file there is no record of any clean operations being
performed on the database. What step have I overlooked?

Andrew Premdas

unread,
Oct 13, 2010, 5:34:04 AM10/13/10
to cu...@googlegroups.com
If you look in support/env.rb you will find instructions. One simple approach is to keep transactions on, test most stuff headless and then turn off transactions and use database cleaner just for your selenium features. If you use the @no-txn tag with these features cucumber will do this automatically for you. 

All best

Andrew



--
You received this message because you are subscribed to the Google Groups "Cukes" group.
To post to this group, send email to cu...@googlegroups.com.
To unsubscribe from this group, send email to cukes+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cukes?hl=en.


mennomenno

unread,
Oct 13, 2010, 5:35:06 AM10/13/10
to Cukes
Hi Stewart,

On Oct 12, 1:10 pm, Stewart <stewart.mathe...@gmail.com> wrote:
> I investigated and found that that  i need to set
> Cucumber::Rails::World.use_transactional_fixtures = false which i have
> in my support/env.rb and that the features have the correct tag on
> them in this case its "@selenium".

I think the idea would be that you leave the transactional fixtures on
(set it back to true) and then use the @selenium tag to mark those
features for which the database cleaner should kick in.

Is the DatabaseCleaner.strategy set to truncation in your env.rb?

Cheers,

Menno
Reply all
Reply to author
Forward
0 new messages