|
|
@ -58,8 +58,23 @@ RSpec.describe "User Features" do |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
context "If a not logged in user tries to access pages that need permissions" do |
|
|
|
context "If user not logged in" do |
|
|
|
it "redirects to log in page" do |
|
|
|
it "'Your account' link does not display" do |
|
|
|
|
|
|
|
visit("/case_logs") |
|
|
|
|
|
|
|
expect(page).to have_no_link("Your account") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "Can navigate and sign in page with sign in button" do |
|
|
|
|
|
|
|
visit("/") |
|
|
|
|
|
|
|
expect(page).to have_link("Case logs") |
|
|
|
|
|
|
|
click_link("Case logs") |
|
|
|
|
|
|
|
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") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "tries to access account page, redirects to log in page" do |
|
|
|
visit("/users/account") |
|
|
|
visit("/users/account") |
|
|
|
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") |
|
|
|
end |
|
|
|
end |
|
|
@ -73,6 +88,13 @@ RSpec.describe "User Features" do |
|
|
|
click_button("Sign in") |
|
|
|
click_button("Sign in") |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it "shows 'Your account' link in navigation if logged in and redirect to correct page" do |
|
|
|
|
|
|
|
visit("/case_logs") |
|
|
|
|
|
|
|
expect(page).to have_link("Your account") |
|
|
|
|
|
|
|
click_link("Your account") |
|
|
|
|
|
|
|
expect(page).to have_current_path("/users/account") |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
it "main page is present and accessible" do |
|
|
|
it "main page is present and accessible" do |
|
|
|
visit("/users/account") |
|
|
|
visit("/users/account") |
|
|
|
expect(page).to have_content("Your account") |
|
|
|
expect(page).to have_content("Your account") |
|
|
|