I have 2 integrations tests, here how it's look :
class TagFlowTest < ActionDispatch::IntegrationTest
include Devise::Test::IntegrationHelpers
setup do
sign_in FactoryGirl.create(:admin)
@partner = create(:partner)
end
test 'can see the list of partners' do
get '/partners'
assert_response :success
assert_select 'tr', 2
end
... more tests below ...
The second test looks the same The thing is that when a launch rails test on this test, it's working fine. But when I launch :
rails test /test/
I got an error :
UnexpectedError: ActiveRecord::RecordNotUnique: PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_users_on_email"
I understand that the issue come from
sign_in FactoryGirl.create(:admin)
When I delete this line on the other test, it's working. But if I do that, I cannot test one test only. How can I do the resolve this ?