The test fails because of wrong email or password even though I create a new account and use it straight away
Heres the files
spec/factories/admins.rb
FactoryGirl.define do
factory :admin do
email 'admin@example.com'
password ('a'..'z').to_a.shuffle.join
end
end
spec/features/sign_in_spec.rb
require 'rails_helper'
describe 'Login', js: true do
admin = FactoryGirl.create(:admin)
it 'I can sign in' do
visit '/admins/sign_in'
fill_in 'Email', :with => admin.email
fill_in 'Password', :with => admin.password
click_button 'Log in'
expect(page).to have_content('Signed in successfully')
end
end