Browse Source

Navigation bar and specs added

pull/113/head
Matthew Phelan 4 years ago
parent
commit
bc649ea8ed
  1. 8
      app/views/layouts/application.html.erb
  2. 16
      spec/features/user_spec.rb

8
app/views/layouts/application.html.erb

@ -38,7 +38,13 @@
logotype: 'GOV.UK', logotype: 'GOV.UK',
service_name: 'Share Lettings and Sales for Social Housing in England Data with DLUHC', service_name: 'Share Lettings and Sales for Social Housing in England Data with DLUHC',
service_url: '/' service_url: '/'
) ) do |component|
unless current_user.nil?
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')
end
end
%> %>
</header> </header>
<aside class="govuk-width-container"> <aside class="govuk-width-container">

16
spec/features/user_spec.rb

@ -58,8 +58,13 @@ 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 "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 +78,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")

Loading…
Cancel
Save