Skip to content

Commit

Permalink
Fix HTML Escape String Comparison in Test supervisor_datatable_spec #…
Browse files Browse the repository at this point in the history
…2810

- Add a supervisor with an apostrophe in their name to the list of inactive supervisors before running the test
- Use CGI::escapeHTML
  • Loading branch information
roseliux committed Oct 22, 2021
1 parent 04349ad commit a2d0022
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions spec/datatables/supervisor_datatable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@

context "when both" do
let(:additional_filters) { {active: %w[false true]} }
let!(:inactive_supervisor) { create(:supervisor, casa_org: org, active: true, display_name: "Neil O'Reilly") }

it "brings only all supervisors", :aggregate_failures do
expect(subject[:recordsTotal]).to eq(2)
expect(subject[:recordsFiltered]).to eq(2)
expect(subject[:data].map { |d| d[:display_name] }).to include(active_supervisor.display_name)
expect(subject[:data].map { |d| d[:display_name] }).to include(inactive_supervisor.display_name)
expect(subject[:data].map { |d| d[:display_name] }).to include(CGI::escapeHTML(active_supervisor.display_name))
expect(subject[:data].map { |d| d[:display_name] }).to include(CGI::escapeHTML(inactive_supervisor.display_name))
end
end

Expand Down

0 comments on commit a2d0022

Please sign in to comment.