You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My model tests used to pass, I have not changed them and now they fail with "name already exists".
I have looked at and tried many solutions but have not found one that works. Also tried using instance variables in my test and moving instantiation to different blocks, before, it, describe and context.
FactoryGirl.define do
factory :activity do
sequence(:name) { |n| "name_#{n}" }
end
end
RSpec.describe Activity do
let(:activity) { FactoryGirl.create :activity }
it "has a valid factory" do
expect(activity).to be_valid
end
end
Are you using transactional fixtures or database cleaner to wipe your specs in between runs? The sequences start over each time you run the tests, so if data persists between runs, you'll get duplicates.
My model tests used to pass, I have not changed them and now they fail with "name already exists".
I have looked at and tried many solutions but have not found one that works. Also tried using instance variables in my test and moving instantiation to different blocks, before, it, describe and context.
rspec-rails > 3.5
factory_girl_rails > 4.8
ruby > 2.3.3
rails > 4.2.0
The text was updated successfully, but these errors were encountered: