diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 6943d7ae2..8f043f6ee 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -39,10 +39,11 @@ service_name: 'Share Lettings and Sales for Social Housing in England Data with DLUHC', service_url: '/' ) do |component| - unless current_user.nil? + if current_user.nil? + component.navigation_item(text: 'Case logs', href: '/case_logs') + elsif component.navigation_item(text: 'Your account', href: '/users/account') - component.navigation_item(text: 'Sign out', href: destroy_user_session_path) - component.navigation_item(text: 'Page C', href: '/#page-c') + component.navigation_item(text: 'Sign out', href: destroy_user_session_path, options: {:method => :delete}) end end %> diff --git a/spec/features/user_spec.rb b/spec/features/user_spec.rb index be8a0b9c4..8aa6e25c4 100644 --- a/spec/features/user_spec.rb +++ b/spec/features/user_spec.rb @@ -64,6 +64,16 @@ RSpec.describe "User Features" do 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") expect(page).to have_content("Sign in to your account to submit CORE data")