Given(/^there is at least (\d+) staff info record$/) do |arg1|
assert_difference('StaffInfo.count', 1) do
@staff_info = FactoryGirl.create :staff_info
end
end
When(/^the shirt size field is empty$/) do
assert @staff_info.update_attribute(:shirt_size, nil)
end
Most probably is because you are combining cucumber with Rails test, meaning you managed to perform a test in a test ... Those assertions might be your problem...
I haven't met this behavior, but most probably your databse_cleaner is cleaning your test after those assertions, which is inside your scenario.
I'd go for something like this:
# Populating my Db and Make sure i have at least one
Given /^there is at least (\d+) staff info record$/ do |arg1|
@staff_info = FactoryGirl.create :staff_info
(arg1.to_i - 1).times do
FactoryGirl.create :staff_info
end
end
# Make sure my model is empty
When /^the shirt size field is empty$/ do
@staff_info.update_attribute(:shirt_size, nil)
end
....
In my support env.rb i would add
World FactoryGirl::Syntax::Methods
Then use create(:staff_info) instead of full FactoryGirl.create syntax ...
Tks.
A.