diff --git a/spec/factories/admin_user.rb b/spec/factories/admin_user.rb index 083e24450..29a5b079b 100644 --- a/spec/factories/admin_user.rb +++ b/spec/factories/admin_user.rb @@ -1,6 +1,6 @@ FactoryBot.define do factory :admin_user do - email { "admin@example.com" } + sequence(:email) { |i| "admin#{i}@example.com" } password { "pAssword1" } created_at { Time.zone.now } updated_at { Time.zone.now } diff --git a/spec/factories/user.rb b/spec/factories/user.rb index 41a613b38..c9f427a98 100644 --- a/spec/factories/user.rb +++ b/spec/factories/user.rb @@ -1,6 +1,6 @@ FactoryBot.define do factory :user do - email { "test@example.com" } + sequence(:email) { |i| "test#{i}@example.com" } password { "pAssword1" } created_at { Time.zone.now } updated_at { Time.zone.now } diff --git a/spec/features/user_spec.rb b/spec/features/user_spec.rb index 3f758ec74..c9e8a17b4 100644 --- a/spec/features/user_spec.rb +++ b/spec/features/user_spec.rb @@ -9,7 +9,7 @@ RSpec.describe "User Features" do it " is redirected to case logs after signing in" do visit("/case_logs") - fill_in("user_email", with: "test@example.com") + fill_in("user_email", with: user.email) fill_in("user_password", with: "pAssword1") click_button("Sign in") expect(page).to have_current_path("/case_logs") @@ -25,16 +25,16 @@ RSpec.describe "User Features" do it " is redirected to check your email page after submitting an email on the reset password page" do visit("/users/password/new") - fill_in("user_email", with: "test@example.com") + fill_in("user_email", with: user.email) click_button("Send email") expect(page).to have_content("Check your email") end it " is shown their email on the password reset confirmation page" do visit("/users/password/new") - fill_in("user_email", with: "test@example.com") + fill_in("user_email", with: user.email) click_button("Send email") - expect(page).to have_content("test@example.com") + expect(page).to have_content(user.email) end it " is shown the reset password confirmation page even if their email doesn't exist in the system" do @@ -46,7 +46,7 @@ RSpec.describe "User Features" do it " is sent a reset password email" do visit("/users/password/new") - fill_in("user_email", with: "test@example.com") + fill_in("user_email", with: user.email) expect { click_button("Send email") }.to change { ActionMailer::Base.deliveries.count }.by(1) end end