I have strange problem with getting model expectations to work with
Cucumber. My setup is that I use Cucumber + Webrat (Selenium backend).
Story I test is registering user on site. Cucumber runs story perfectly
fine, and I see it fills in form, sends it, I even see proper “You have
successfully registered” message at the end. However, as a last element
of story I want to make sure the user was really created in database -
and this fails.
I have definition of following step:
Then /^should exist exactly “(.*)” users$/ do |cnt, state|
User.count.should == cnt.to_i
However, it always complains that there are 0 users, when expected X.
What is even more stranger, when I log into console, and do User.count,
I get proper number of users - they were actually created during running