I am using FactoryGirl with Shoulda to test my application.
Actually my code works fine, but I am getting warning that #next method was deprecated.
I can’t find solution how to avoid this. I can’t see anywhere the proposed
run method.. Some opinions?
Factory.define :user do |user|
user.first_name 'John'
user.last_name 'Sheppard'
user.after_create { |_t| _t.contact.update_attribute :email, Factory.next(:email) }
end
Factory.sequence :email do |n|
"john#{n}.sheppard@topmonks.com"
end
WARNING: FactoryGirl::Sequence#next is deprecated.
Use #run instead.
I think you should just be able to call Factory(:email) here – you will get the next in the sequence automatically