diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 80b1cb6cd..660b80bb8 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -38,7 +38,7 @@ <%= govuk_header( logotype: 'GOV.UK', service_name: t('service_name'), - service_url: '/' + service_url: current_user.nil? ? "/" : '/logs' ) do |component| if current_user.nil? component.navigation_item(text: 'Sign in', href: user_session_path) diff --git a/spec/requests/user_controller_spec.rb b/spec/requests/user_controller_spec.rb index 2830f522b..0553aba95 100644 --- a/spec/requests/user_controller_spec.rb +++ b/spec/requests/user_controller_spec.rb @@ -90,6 +90,14 @@ RSpec.describe "password_reset", type: :request do end end end + + describe "title link" do + it "routes user to the /logs page" do + get "/", headers: headers, params: {} + expected_link = "href=\"/\">#{I18n.t('service_name')}" + expect(CGI.unescape_html(response.body)).to include(expected_link) + end + end end describe "#show" do @@ -224,4 +232,16 @@ RSpec.describe "password_reset", type: :request do end end end + + describe "title link" do + before do + sign_in user + end + + it "routes user to the /logs page" do + get "/", headers: headers, params: {} + expected_link = "href=\"/logs\">#{I18n.t('service_name')}" + expect(CGI.unescape_html(response.body)).to include(expected_link) + end + end end