From 919f8dba463396514b493f08772cc26edb9a71ec Mon Sep 17 00:00:00 2001 From: Rocela Durazo Date: Thu, 21 Oct 2021 12:06:11 -0700 Subject: [PATCH] Fix HTML Escape String Comparison in Test supervisor_datatable_spec #2810 - Add a supervisor with an apostrophe in their name to the list of inactive supervisors before running the test - Use CGI::escapeHTML --- spec/datatables/supervisor_datatable_spec.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/datatables/supervisor_datatable_spec.rb b/spec/datatables/supervisor_datatable_spec.rb index 7d53323162..3598e60e2f 100644 --- a/spec/datatables/supervisor_datatable_spec.rb +++ b/spec/datatables/supervisor_datatable_spec.rb @@ -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