thoughtbot/factory_girl — Issue #249: FactoryGirl sequencing not giving unique value
Author: arnies
Created: 2011-12-06 22:47:03+00:00
State: open

I have a Factory created that uses a sequence for the email field:

FactoryGirl.define do

sequence :user_email do |n|
"user#{n}@example#{n}.com"
end

factory :user do
email {Factory.next :user_email}
password "password"
password_confirmation "password"
#confirmed_at { 1.day.ago }
start_date DateTime.now
end_date DateTime.now + 5
end
end

when running rake:test the sequence fails. When running rake:functionals the sequence passes. When running the individual test the sequence passes.

No idea what could be causing this