Browse Source

Escape html in tests to handle names with punctuation (#3002)

Co-authored-by: Carolyn <carolyn.barker@softwire.com>
CLDC-3939-test-tests-remotely
carolynbarker 4 days ago committed by GitHub
parent
commit
0e919b0f78
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      spec/helpers/tab_nav_helper_spec.rb
  2. 2
      spec/requests/bulk_upload_lettings_results_controller_spec.rb
  3. 4
      spec/requests/bulk_upload_sales_results_controller_spec.rb

4
spec/helpers/tab_nav_helper_spec.rb

@ -16,7 +16,7 @@ RSpec.describe TabNavHelper do
describe "#org_cell" do
it "returns the users org name and role separated by a newline character" do
expected_html = "#{organisation.name}\n<span class=\"app-!-colour-muted\">Data provider</span>"
expect(org_cell(current_user)).to match(expected_html)
expect(CGI.unescapeHTML(org_cell(current_user))).to match(expected_html)
end
end
@ -30,7 +30,7 @@ RSpec.describe TabNavHelper do
describe "#scheme_cell" do
it "returns the scheme link service name and primary user group separated by a newline character" do
expected_html = "<a class=\"govuk-link\" href=\"/schemes/#{scheme.id}\">#{scheme.service_name}</a>\n<span class=\"govuk-visually-hidden\">Scheme</span>"
expect(scheme_cell(scheme)).to match(expected_html)
expect(CGI.unescapeHTML(scheme_cell(scheme))).to match(expected_html)
end
end
end

2
spec/requests/bulk_upload_lettings_results_controller_spec.rb

@ -138,7 +138,7 @@ RSpec.describe BulkUploadLettingsResultsController, type: :request do
get "/lettings-logs/bulk-upload-results/#{bulk_upload.id}/summary"
expect(response.body).to include("This error report is out of date.")
expect(response.body).to include("Some logs in this upload are assigned to #{other_user.name}, who has moved to a different organisation since this file was uploaded. Upload the file again to get an accurate error report.")
expect(CGI.unescapeHTML(response.body)).to include("Some logs in this upload are assigned to #{other_user.name}, who has moved to a different organisation since this file was uploaded. Upload the file again to get an accurate error report.")
end
end

4
spec/requests/bulk_upload_sales_results_controller_spec.rb

@ -30,7 +30,7 @@ RSpec.describe BulkUploadSalesResultsController, type: :request do
get "/sales-logs/bulk-upload-results/#{bulk_upload.id}/summary"
expect(response.body).to include("This error report is out of date.")
expect(response.body).to include("Some logs in this upload are assigned to #{user.name}, who has moved to a different organisation since this file was uploaded. Upload the file again to get an accurate error report.")
expect(CGI.unescapeHTML(response.body)).to include("Some logs in this upload are assigned to #{user.name}, who has moved to a different organisation since this file was uploaded. Upload the file again to get an accurate error report.")
end
end
@ -113,7 +113,7 @@ RSpec.describe BulkUploadSalesResultsController, type: :request do
get "/sales-logs/bulk-upload-results/#{bulk_upload.id}/summary"
expect(response.body).to include("This error report is out of date.")
expect(response.body).to include("Some logs in this upload are assigned to #{other_user.name}, who has moved to a different organisation since this file was uploaded. Upload the file again to get an accurate error report.")
expect(CGI.unescapeHTML(response.body)).to include("Some logs in this upload are assigned to #{other_user.name}, who has moved to a different organisation since this file was uploaded. Upload the file again to get an accurate error report.")
end
end

Loading…
Cancel
Save