Browse Source

Change title link (#236)

* Change title link

* Add tests
pull/239/head
kosiakkatrina 3 years ago committed by GitHub
parent
commit
b07d546bc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/views/layouts/application.html.erb
  2. 20
      spec/requests/user_controller_spec.rb

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

@ -38,7 +38,7 @@
<%= govuk_header( <%= govuk_header(
logotype: 'GOV.UK', logotype: 'GOV.UK',
service_name: t('service_name'), service_name: t('service_name'),
service_url: '/' service_url: current_user.nil? ? "/" : '/logs'
) do |component| ) do |component|
if current_user.nil? if current_user.nil?
component.navigation_item(text: 'Sign in', href: user_session_path) component.navigation_item(text: 'Sign in', href: user_session_path)

20
spec/requests/user_controller_spec.rb

@ -90,6 +90,14 @@ RSpec.describe "password_reset", type: :request do
end end
end 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')}</a>"
expect(CGI.unescape_html(response.body)).to include(expected_link)
end
end
end end
describe "#show" do describe "#show" do
@ -224,4 +232,16 @@ RSpec.describe "password_reset", type: :request do
end end
end 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')}</a>"
expect(CGI.unescape_html(response.body)).to include(expected_link)
end
end
end end

Loading…
Cancel
Save