Browse Source

Fix some flaky tests

pull/2850/head
Kat 1 year ago
parent
commit
714fa413b5
  1. 8
      spec/requests/organisation_relationships_controller_spec.rb
  2. 6
      spec/requests/organisations_controller_spec.rb

8
spec/requests/organisation_relationships_controller_spec.rb

@ -40,7 +40,7 @@ RSpec.describe OrganisationRelationshipsController, type: :request do
it "shows a table of stock owners" do it "shows a table of stock owners" do
expected_html = "<table class=\"govuk-table\"" expected_html = "<table class=\"govuk-table\""
expect(response.body).to include(expected_html) expect(response.body).to include(expected_html)
expect(response.body).to include(stock_owner.name) expect(CGI.unescapeHTML(response.body)).to include(stock_owner.name)
end end
it "shows only stock owners for the current user's organisation" do it "shows only stock owners for the current user's organisation" do
@ -136,7 +136,7 @@ RSpec.describe OrganisationRelationshipsController, type: :request do
it "shows a table of managing-agents" do it "shows a table of managing-agents" do
expected_html = "<table class=\"govuk-table\"" expected_html = "<table class=\"govuk-table\""
expect(response.body).to include(expected_html) expect(response.body).to include(expected_html)
expect(response.body).to include(managing_agent.name) expect(CGI.unescapeHTML(response.body)).to include(managing_agent.name)
end end
it "shows only managing-agents for the current user's organisation" do it "shows only managing-agents for the current user's organisation" do
@ -336,7 +336,7 @@ RSpec.describe OrganisationRelationshipsController, type: :request do
it "shows a table of stock owners" do it "shows a table of stock owners" do
expected_html = "<table class=\"govuk-table\"" expected_html = "<table class=\"govuk-table\""
expect(response.body).to include(expected_html) expect(response.body).to include(expected_html)
expect(response.body).to include(stock_owner.name) expect(CGI.unescapeHTML(response.body)).to include(stock_owner.name)
end end
it "shows only stock owners for the current user's organisation" do it "shows only stock owners for the current user's organisation" do
@ -472,7 +472,7 @@ RSpec.describe OrganisationRelationshipsController, type: :request do
it "shows a table of managing agents" do it "shows a table of managing agents" do
expected_html = "<table class=\"govuk-table\"" expected_html = "<table class=\"govuk-table\""
expect(response.body).to include(expected_html) expect(response.body).to include(expected_html)
expect(response.body).to include(managing_agent.name) expect(CGI.unescapeHTML(response.body)).to include(managing_agent.name)
end end
it "shows only managing agents for the current user's organisation" do it "shows only managing agents for the current user's organisation" do

6
spec/requests/organisations_controller_spec.rb

@ -487,7 +487,7 @@ RSpec.describe OrganisationsController, type: :request do
it "shows a summary list of org details" do it "shows a summary list of org details" do
expected_html = "<dl class=\"govuk-summary-list\"" expected_html = "<dl class=\"govuk-summary-list\""
expect(response.body).to include(expected_html) expect(response.body).to include(expected_html)
expect(response.body).to include(organisation.name) expect(CGI.unescapeHTML(response.body)).to include(organisation.name)
end end
it "does not include a change details link" do it "does not include a change details link" do
@ -663,7 +663,7 @@ RSpec.describe OrganisationsController, type: :request do
end end
it "shows an edit form without name field" do it "shows an edit form without name field" do
expect(response.body).to include("Change #{organisation.name}’s details") expect(CGI.unescapeHTML(response.body)).to include("Change #{organisation.name}’s details")
expect(page).not_to have_field("organisation-name-field") expect(page).not_to have_field("organisation-name-field")
expect(page).to have_field("organisation-phone-field") expect(page).to have_field("organisation-phone-field")
end end
@ -945,7 +945,7 @@ RSpec.describe OrganisationsController, type: :request do
it "shows a summary list of org details" do it "shows a summary list of org details" do
expected_html = "<dl class=\"govuk-summary-list\"" expected_html = "<dl class=\"govuk-summary-list\""
expect(response.body).to include(expected_html) expect(response.body).to include(expected_html)
expect(response.body).to include(organisation.name) expect(CGI.unescapeHTML(response.body)).to include(organisation.name)
end end
it "does not have a change details link" do it "does not have a change details link" do

Loading…
Cancel
Save