Browse Source

CLDC-2434 Fix test warnings and update some flaky tests (#2850)

* Remove test warnings

* Fix some flaky tests
CLDC-3788-export-sales-logs
kosiakkatrina 3 weeks ago committed by GitHub
parent
commit
918cf0f08f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      spec/requests/lettings_logs_controller_spec.rb
  2. 8
      spec/requests/organisation_relationships_controller_spec.rb
  3. 6
      spec/requests/organisations_controller_spec.rb
  4. 2
      spec/requests/sales_logs_controller_spec.rb

2
spec/requests/lettings_logs_controller_spec.rb

@ -1483,7 +1483,7 @@ RSpec.describe LettingsLogsController, type: :request do
end end
context "when viewing a collection of logs affected by deactivated location" do context "when viewing a collection of logs affected by deactivated location" do
let!(:affected_lettings_logs) { FactoryBot.create_list(:lettings_log, 3, unresolved: true, assigned_to: user) } let!(:affected_lettings_logs) { FactoryBot.create_list(:lettings_log, 3, unresolved: true, assigned_to: user, tenancycode: "affected tenancycode", propcode: "affected propcode") }
let!(:other_user_affected_lettings_log) { FactoryBot.create(:lettings_log, unresolved: true) } let!(:other_user_affected_lettings_log) { FactoryBot.create(:lettings_log, unresolved: true) }
let!(:non_affected_lettings_logs) { FactoryBot.create_list(:lettings_log, 4, assigned_to: user) } let!(:non_affected_lettings_logs) { FactoryBot.create_list(:lettings_log, 4, assigned_to: user) }
let(:other_user) { FactoryBot.create(:user, organisation: user.organisation) } let(:other_user) { FactoryBot.create(:user, organisation: user.organisation) }

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

2
spec/requests/sales_logs_controller_spec.rb

@ -299,7 +299,7 @@ RSpec.describe SalesLogsController, type: :request do
it "does not render pending logs" do it "does not render pending logs" do
get "/sales-logs", headers: headers, params: {} get "/sales-logs", headers: headers, params: {}
expect(page).not_to have_link(invisible_log.id, href: "sales-logs/#{invisible_log.id}") expect(page).not_to have_link(invisible_log.id.to_s, href: "sales-logs/#{invisible_log.id}")
end end
end end

Loading…
Cancel
Save