|
|
@ -9,8 +9,8 @@ RSpec.describe "User Features" do |
|
|
|
|
|
|
|
|
|
|
|
it " is redirected to case logs after signing in" do |
|
|
|
it " is redirected to case logs after signing in" do |
|
|
|
visit("/case_logs") |
|
|
|
visit("/case_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") |
|
|
|
click_button("Sign in") |
|
|
|
click_button("Sign in") |
|
|
|
expect(page).to have_current_path("/case_logs") |
|
|
|
expect(page).to have_current_path("/case_logs") |
|
|
|
end |
|
|
|
end |
|
|
@ -25,34 +25,34 @@ RSpec.describe "User Features" do |
|
|
|
|
|
|
|
|
|
|
|
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("/users/password/new") |
|
|
|
visit("/users/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("/users/password/new") |
|
|
|
visit("/users/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("/users/password/new") |
|
|
|
visit("/users/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("/confirmations/reset?email=idontexist%40example.com") |
|
|
|
expect(page).to have_current_path("/confirmations/reset?email=idontexist%40example.com") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it " is sent a reset password email" do |
|
|
|
it " is sent a reset password email" do |
|
|
|
visit("/users/password/new") |
|
|
|
visit("/users/password/new") |
|
|
|
fill_in("user_email", with: user.email) |
|
|
|
fill_in("user[email]", with: user.email) |
|
|
|
expect { click_button("Send email") }.to change { ActionMailer::Base.deliveries.count }.by(1) |
|
|
|
expect { click_button("Send email") }.to change { ActionMailer::Base.deliveries.count }.by(1) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it " is shown the password reset confirmation page and successful flash message shows" do |
|
|
|
it " is shown the password reset confirmation page and successful flash message shows" do |
|
|
|
visit("/users/password/new") |
|
|
|
visit("/users/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_css ".govuk-notification-banner.govuk-notification-banner--success" |
|
|
|
expect(page).to have_css ".govuk-notification-banner.govuk-notification-banner--success" |
|
|
|
end |
|
|
|
end |
|
|
@ -68,8 +68,8 @@ RSpec.describe "User Features" do |
|
|
|
visit("/") |
|
|
|
visit("/") |
|
|
|
expect(page).to have_link("Case logs") |
|
|
|
expect(page).to have_link("Case logs") |
|
|
|
click_link("Case logs") |
|
|
|
click_link("Case 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") |
|
|
|
click_button("Sign in") |
|
|
|
click_button("Sign in") |
|
|
|
expect(page).to have_current_path("/case_logs") |
|
|
|
expect(page).to have_current_path("/case_logs") |
|
|
|
end |
|
|
|
end |
|
|
@ -83,8 +83,8 @@ RSpec.describe "User Features" do |
|
|
|
context "Your Account " do |
|
|
|
context "Your Account " do |
|
|
|
before(:each) do |
|
|
|
before(:each) do |
|
|
|
visit("/case_logs") |
|
|
|
visit("/case_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") |
|
|
|
click_button("Sign in") |
|
|
|
click_button("Sign in") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
@ -114,8 +114,8 @@ RSpec.describe "User Features" do |
|
|
|
visit("/users/account") |
|
|
|
visit("/users/account") |
|
|
|
click_link("change-password") |
|
|
|
click_link("change-password") |
|
|
|
expect(page).to have_content("Change your password") |
|
|
|
expect(page).to have_content("Change your password") |
|
|
|
fill_in("user_current_password", with: "pAssword1") |
|
|
|
fill_in("user[current_password]", with: "pAssword1") |
|
|
|
fill_in("user_password", with: "Password123!") |
|
|
|
fill_in("user[password]", with: "Password123!") |
|
|
|
click_button("Update") |
|
|
|
click_button("Update") |
|
|
|
expect(page).to have_current_path("/users/account") |
|
|
|
expect(page).to have_current_path("/users/account") |
|
|
|
end |
|
|
|
end |
|
|
@ -124,7 +124,7 @@ RSpec.describe "User Features" do |
|
|
|
visit("/users/account") |
|
|
|
visit("/users/account") |
|
|
|
click_link("change-name") |
|
|
|
click_link("change-name") |
|
|
|
expect(page).to have_content("Change your personal details") |
|
|
|
expect(page).to have_content("Change your personal details") |
|
|
|
fill_in("user_name", with: "Test New") |
|
|
|
fill_in("user[name]", with: "Test New") |
|
|
|
click_button("Save changes") |
|
|
|
click_button("Save changes") |
|
|
|
expect(page).to have_current_path("/users/account") |
|
|
|
expect(page).to have_current_path("/users/account") |
|
|
|
expect(page).to have_content("Test New") |
|
|
|
expect(page).to have_content("Test New") |
|
|
|