Browse Source

tests

pull/477/head
Kat 3 years ago committed by Paul Robert Lloyd
parent
commit
1678e8c6a4
  1. 9
      spec/features/organisation_spec.rb
  2. 6
      spec/requests/organisations_controller_spec.rb
  3. 7
      spec/requests/users_controller_spec.rb

9
spec/features/organisation_spec.rb

@ -24,7 +24,7 @@ RSpec.describe "User Features" do
context "when viewing organisation page" do
it "defaults to organisation details" do
visit("/logs")
click_link("Your organisation")
click_link("About Your Organisation")
expect(page).to have_content(user.organisation.name)
end
@ -32,7 +32,7 @@ RSpec.describe "User Features" do
visit("/organisations/#{org_id}")
click_link("Users")
expect(page).to have_current_path("/organisations/#{org_id}/users")
click_link("Details")
click_link("About Your Organisation")
expect(page).to have_current_path("/organisations/#{org_id}/details")
end
end
@ -72,10 +72,11 @@ RSpec.describe "User Features" do
context "when viewing organisation page" do
it "can see the details tab and users tab" do
visit("/logs")
click_link("Your organisation")
click_link("About Your Organisation")
expect(page).to have_current_path("/organisations/#{org_id}/details")
expect(page).to have_link("Details")
expect(page).to have_link("Logs")
expect(page).to have_link("Users")
expect(page).to have_link("About Your Organisation")
end
end
end

6
spec/requests/organisations_controller_spec.rb

@ -66,7 +66,7 @@ RSpec.describe OrganisationsController, type: :request do
end
it "shows the tab navigation" do
expected_html = "<nav class=\"app-tab-navigation\""
expected_html = "<nav class=\"app-primary-navigation\""
expect(response.body).to include(expected_html)
end
@ -107,7 +107,7 @@ RSpec.describe OrganisationsController, type: :request do
end
it "shows the tab navigation" do
expected_html = "<nav class=\"app-tab-navigation\""
expected_html = "<nav class=\"app-primary-navigation\""
expect(response.body).to include(expected_html)
end
@ -218,7 +218,7 @@ RSpec.describe OrganisationsController, type: :request do
end
it "shows the tab navigation" do
expected_html = "<nav class=\"app-tab-navigation\""
expected_html = "<nav class=\"app-primary-navigation\""
expect(response.body).to include(expected_html)
end

7
spec/requests/users_controller_spec.rb

@ -104,7 +104,9 @@ RSpec.describe UsersController, type: :request do
describe "title link" do
it "routes user to the /logs page" do
get "/", headers:, params: {}
expected_link = "href=\"/\">#{I18n.t('service_name')}</a>"
follow_redirect!
expect(path).to include("/logs")
expected_link = "<a class=\"govuk-header__link govuk-header__link--homepage\" href=\"/\">"
expect(CGI.unescape_html(response.body)).to include(expected_link)
end
end
@ -1110,8 +1112,9 @@ RSpec.describe UsersController, type: :request do
it "routes user to the /logs page" do
get "/", headers:, params: {}
expected_link = "href=\"/logs\">#{I18n.t('service_name')}</a>"
follow_redirect!
expect(path).to include("/logs")
expected_link = "<a class=\"govuk-header__link govuk-header__link--homepage\" href=\"/\">"
expect(CGI.unescape_html(response.body)).to include(expected_link)
end
end

Loading…
Cancel
Save