Browse Source

feat: test home/start paths explicitly

pull/2119/head
natdeanlewissoftwire 1 year ago
parent
commit
fc011f1d3f
  1. 4
      spec/requests/start_controller_spec.rb
  2. 4
      spec/requests/users_controller_spec.rb

4
spec/requests/start_controller_spec.rb

@ -15,9 +15,9 @@ RSpec.describe StartController, type: :request do
describe "GET" do describe "GET" do
context "when the user is not signed in" do context "when the user is not signed in" do
it "routes user to the start in page" do it "routes user to the start page" do
get "/", headers: headers, params: {} get "/", headers: headers, params: {}
expect(path).to include("/") expect(path).to eq("/")
expect(page).to have_content("Start now") expect(page).to have_content("Start now")
end end
end end

4
spec/requests/users_controller_spec.rb

@ -76,7 +76,7 @@ RSpec.describe UsersController, type: :request do
it "routes user to the home page" do it "routes user to the home page" do
sign_in user sign_in user
get "/", headers:, params: {} get "/", headers:, params: {}
expect(path).to include("/") expect(path).to eq("/")
expect(page).to have_content("Welcome back") expect(page).to have_content("Welcome back")
expected_link = "<a class=\"govuk-header__link govuk-header__link--homepage\" href=\"/\">" expected_link = "<a class=\"govuk-header__link govuk-header__link--homepage\" href=\"/\">"
expect(CGI.unescape_html(response.body)).to include(expected_link) expect(CGI.unescape_html(response.body)).to include(expected_link)
@ -2027,7 +2027,7 @@ RSpec.describe UsersController, type: :request do
it "routes user to the home page" do it "routes user to the home page" do
get "/", headers:, params: {} get "/", headers:, params: {}
expect(path).to include("/") expect(path).to eq("/")
expect(page).to have_content("Welcome back") expect(page).to have_content("Welcome back")
expected_link = "<a class=\"govuk-header__link govuk-header__link--homepage\" href=\"/\">" expected_link = "<a class=\"govuk-header__link govuk-header__link--homepage\" href=\"/\">"
expect(CGI.unescape_html(response.body)).to include(expected_link) expect(CGI.unescape_html(response.body)).to include(expected_link)

Loading…
Cancel
Save