|
|
@ -15,7 +15,7 @@ RSpec.describe "User Features" do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "when the user navigates to case logs" do |
|
|
|
context "when the user navigates to case logs" do |
|
|
|
it " is required to log in" do |
|
|
|
it "is required to log in" do |
|
|
|
visit("/logs") |
|
|
|
visit("/logs") |
|
|
|
expect(page).to have_current_path("/account/sign-in") |
|
|
|
expect(page).to have_current_path("/account/sign-in") |
|
|
|
expect(page).to have_content("Sign in to your account to submit CORE data") |
|
|
|
expect(page).to have_content("Sign in to your account to submit CORE data") |
|
|
@ -26,7 +26,7 @@ RSpec.describe "User Features" do |
|
|
|
expect(page).to have_no_content("You need to sign in or sign up before continuing.") |
|
|
|
expect(page).to have_no_content("You need to sign in or sign up before continuing.") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it " is redirected to case logs after signing in" do |
|
|
|
it "is redirected to case logs after signing in" do |
|
|
|
visit("/logs") |
|
|
|
visit("/logs") |
|
|
|
fill_in("user[email]", with: user.email) |
|
|
|
fill_in("user[email]", with: user.email) |
|
|
|
fill_in("user[password]", with: "pAssword1") |
|
|
|
fill_in("user[password]", with: "pAssword1") |
|
|
@ -34,7 +34,7 @@ RSpec.describe "User Features" do |
|
|
|
expect(page).to have_current_path("/logs") |
|
|
|
expect(page).to have_current_path("/logs") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it " can log out again", js: true do |
|
|
|
it "can log out again", js: true do |
|
|
|
visit("/logs") |
|
|
|
visit("/logs") |
|
|
|
fill_in("user[email]", with: user.email) |
|
|
|
fill_in("user[email]", with: user.email) |
|
|
|
fill_in("user[password]", with: "pAssword1") |
|
|
|
fill_in("user[password]", with: "pAssword1") |
|
|
@ -44,7 +44,7 @@ RSpec.describe "User Features" do |
|
|
|
expect(page).to have_content("Start now") |
|
|
|
expect(page).to have_content("Start now") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it " can log out again with js disabled" do |
|
|
|
it "can log out again with js disabled" do |
|
|
|
visit("/logs") |
|
|
|
visit("/logs") |
|
|
|
fill_in("user[email]", with: user.email) |
|
|
|
fill_in("user[email]", with: user.email) |
|
|
|
fill_in("user[password]", with: "pAssword1") |
|
|
|
fill_in("user[password]", with: "pAssword1") |
|
|
@ -56,13 +56,13 @@ RSpec.describe "User Features" do |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "when the user has forgotten their password" do |
|
|
|
context "when the user has forgotten their password" do |
|
|
|
it " is redirected to the reset password page when they click the reset password link" do |
|
|
|
it "is redirected to the reset password page when they click the reset password link" do |
|
|
|
visit("/logs") |
|
|
|
visit("/logs") |
|
|
|
click_link("reset your password") |
|
|
|
click_link("reset your password") |
|
|
|
expect(page).to have_current_path("/account/password/new") |
|
|
|
expect(page).to have_current_path("/account/password/new") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it " is shown an error message if they submit without entering an email address" do |
|
|
|
it "is shown an error message if they submit without entering an email address" do |
|
|
|
visit("/account/password/new") |
|
|
|
visit("/account/password/new") |
|
|
|
click_button("Send email") |
|
|
|
click_button("Send email") |
|
|
|
expect(page).to have_selector("#error-summary-title") |
|
|
|
expect(page).to have_selector("#error-summary-title") |
|
|
@ -70,7 +70,7 @@ RSpec.describe "User Features" do |
|
|
|
expect(page).to have_title("Error") |
|
|
|
expect(page).to have_title("Error") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it " is shown an error message if they submit an invalid email address" do |
|
|
|
it "is shown an error message if they submit an invalid email address" do |
|
|
|
visit("/account/password/new") |
|
|
|
visit("/account/password/new") |
|
|
|
fill_in("user[email]", with: "thisisn'tanemail") |
|
|
|
fill_in("user[email]", with: "thisisn'tanemail") |
|
|
|
click_button("Send email") |
|
|
|
click_button("Send email") |
|
|
@ -79,28 +79,28 @@ RSpec.describe "User Features" do |
|
|
|
expect(page).to have_title("Error") |
|
|
|
expect(page).to have_title("Error") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it " is redirected to check your email page after submitting an email on the reset password page" do |
|
|
|
it "is redirected to check your email page after submitting an email on the reset password page" do |
|
|
|
visit("/account/password/new") |
|
|
|
visit("/account/password/new") |
|
|
|
fill_in("user[email]", with: user.email) |
|
|
|
fill_in("user[email]", with: user.email) |
|
|
|
click_button("Send email") |
|
|
|
click_button("Send email") |
|
|
|
expect(page).to have_content("Check your email") |
|
|
|
expect(page).to have_content("Check your email") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it " is shown their email on the password reset confirmation page" do |
|
|
|
it "is shown their email on the password reset confirmation page" do |
|
|
|
visit("/account/password/new") |
|
|
|
visit("/account/password/new") |
|
|
|
fill_in("user[email]", with: user.email) |
|
|
|
fill_in("user[email]", with: user.email) |
|
|
|
click_button("Send email") |
|
|
|
click_button("Send email") |
|
|
|
expect(page).to have_content(user.email) |
|
|
|
expect(page).to have_content(user.email) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it " is shown the reset password confirmation page even if their email doesn't exist in the system" do |
|
|
|
it "is shown the reset password confirmation page even if their email doesn't exist in the system" do |
|
|
|
visit("/account/password/new") |
|
|
|
visit("/account/password/new") |
|
|
|
fill_in("user[email]", with: "idontexist@example.com") |
|
|
|
fill_in("user[email]", with: "idontexist@example.com") |
|
|
|
click_button("Send email") |
|
|
|
click_button("Send email") |
|
|
|
expect(page).to have_current_path("/account/password/reset-confirmation?email=idontexist%40example.com") |
|
|
|
expect(page).to have_current_path("/account/password/reset-confirmation?email=idontexist%40example.com") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it " is sent a reset password email via Notify" do |
|
|
|
it "is sent a reset password email via Notify" do |
|
|
|
expect(notify_client).to receive(:send_email).with( |
|
|
|
expect(notify_client).to receive(:send_email).with( |
|
|
|
{ |
|
|
|
{ |
|
|
|
email_address: user.email, |
|
|
|
email_address: user.email, |
|
|
@ -448,13 +448,13 @@ RSpec.describe "User Features" do |
|
|
|
allow(notify_client).to receive(:send_email).and_return(true) |
|
|
|
allow(notify_client).to receive(:send_email).and_return(true) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it " is redirected to the reset password page when they click the reset password link" do |
|
|
|
it "is redirected to the reset password page when they click the reset password link" do |
|
|
|
visit("/account/sign-in") |
|
|
|
visit("/account/sign-in") |
|
|
|
click_link("reset your password") |
|
|
|
click_link("reset your password") |
|
|
|
expect(page).to have_current_path("/account/password/new") |
|
|
|
expect(page).to have_current_path("/account/password/new") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it " is shown an error message if they submit without entering an email address" do |
|
|
|
it "is shown an error message if they submit without entering an email address" do |
|
|
|
visit("/account/password/new") |
|
|
|
visit("/account/password/new") |
|
|
|
click_button("Send email") |
|
|
|
click_button("Send email") |
|
|
|
expect(page).to have_selector("#error-summary-title") |
|
|
|
expect(page).to have_selector("#error-summary-title") |
|
|
@ -462,14 +462,14 @@ RSpec.describe "User Features" do |
|
|
|
expect(page).to have_title("Error") |
|
|
|
expect(page).to have_title("Error") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it " is redirected to login page after reset email is sent" do |
|
|
|
it "is redirected to login page after reset email is sent" do |
|
|
|
visit("/account/password/new") |
|
|
|
visit("/account/password/new") |
|
|
|
fill_in("user[email]", with: support_user.email) |
|
|
|
fill_in("user[email]", with: support_user.email) |
|
|
|
click_button("Send email") |
|
|
|
click_button("Send email") |
|
|
|
expect(page).to have_content("Check your email") |
|
|
|
expect(page).to have_content("Check your email") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it " is sent a reset password email via Notify" do |
|
|
|
it "is sent a reset password email via Notify" do |
|
|
|
expect(notify_client).to receive(:send_email).with( |
|
|
|
expect(notify_client).to receive(:send_email).with( |
|
|
|
{ |
|
|
|
{ |
|
|
|
email_address: support_user.email, |
|
|
|
email_address: support_user.email, |
|
|
|