From 375c0dfcd6894ec26c09a1cc956f91d8d3e03dd9 Mon Sep 17 00:00:00 2001 From: Stefanni Brasil Date: Tue, 3 Feb 2026 14:34:52 -0700 Subject: [PATCH 1/2] Upgrade standard-rails dependency to 1.6.0 --- Gemfile.lock | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 3b4d56c692..c322949710 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -280,7 +280,7 @@ GEM csv mini_mime (>= 1.0.0) multi_xml (>= 0.5.2) - i18n (1.14.7) + i18n (1.14.8) concurrent-ruby (~> 1.0) image_processing (1.14.0) mini_magick (>= 4.9.5, < 6) @@ -334,7 +334,8 @@ GEM logger mini_mime (1.1.5) mini_portile2 (2.8.9) - minitest (5.27.0) + minitest (6.0.1) + prism (~> 1.5) multi_xml (0.8.1) bigdecimal (>= 3.1, < 5) multipart-post (2.4.1) @@ -403,7 +404,7 @@ GEM parallel paranoia (3.0.1) activerecord (>= 6, < 8.1) - parser (3.3.10.0) + parser (3.3.10.1) ast (~> 2.4.1) racc pdf-forms (1.5.2) @@ -420,7 +421,7 @@ GEM pretender (0.6.0) actionpack (>= 7.1) prettyprint (0.2.0) - prism (1.7.0) + prism (1.9.0) pry (0.15.2) coderay (~> 1.1) method_source (~> 1.0) @@ -558,12 +559,12 @@ GEM lint_roller (~> 1.1) rubocop (>= 1.75.0, < 2.0) rubocop-ast (>= 1.47.1, < 2.0) - rubocop-rails (2.31.0) + rubocop-rails (2.34.3) activesupport (>= 4.2.0) lint_roller (~> 1.1) rack (>= 1.1) rubocop (>= 1.75.0, < 2.0) - rubocop-ast (>= 1.38.0, < 2.0) + rubocop-ast (>= 1.44.0, < 2.0) rubocop-rspec (3.7.0) lint_roller (~> 1.1) rubocop (~> 1.72, >= 1.72.1) @@ -637,9 +638,9 @@ GEM standard-performance (1.9.0) lint_roller (~> 1.1) rubocop-performance (~> 1.26.0) - standard-rails (1.4.0) + standard-rails (1.6.0) lint_roller (~> 1.0) - rubocop-rails (~> 2.31.0) + rubocop-rails (~> 2.34.0) stimulus-rails (1.3.4) railties (>= 6.0.0) stringio (3.1.9) From ec6ae71008db4d61e384cd8768b3d665cb0ab68f Mon Sep 17 00:00:00 2001 From: Stefanni Brasil Date: Tue, 3 Feb 2026 14:40:48 -0700 Subject: [PATCH 2/2] Fix standard-rails v1.6.0 problems The RailsPluck cop is disabled by default because it can lead to some problems when associations are not loaded inside of iterations. However, all the problems being fixed here are from tests and since they are passing, I am assuming there are no issues following this cop. https://docs.rubocop.org/rubocop-rails/cops_rails.html#railspluck --- .../datatables/case_contact_datatable_spec.rb | 36 +++++++++---------- spec/datatables/supervisor_datatable_spec.rb | 12 +++---- spec/datatables/volunteer_datatable_spec.rb | 6 ++-- spec/models/casa_org_spec.rb | 2 +- spec/models/case_court_report_context_spec.rb | 8 ++--- spec/models/contact_topic_spec.rb | 4 +-- .../all_casa_admins/casa_orgs_spec.rb | 4 +-- .../case_contacts_new_design_spec.rb | 6 ++-- 8 files changed, 39 insertions(+), 39 deletions(-) diff --git a/spec/datatables/case_contact_datatable_spec.rb b/spec/datatables/case_contact_datatable_spec.rb index 970ed186c3..a68ec02be8 100644 --- a/spec/datatables/case_contact_datatable_spec.rb +++ b/spec/datatables/case_contact_datatable_spec.rb @@ -173,8 +173,8 @@ let(:search_term) { "John" } it "returns matching case contacts" do - expect(datatable.as_json[:data].map { |d| d[:id] }).to include(john_contact.id.to_s) - expect(datatable.as_json[:data].map { |d| d[:id] }).not_to include(jane_contact.id.to_s) + expect(datatable.as_json[:data].pluck(:id)).to include(john_contact.id.to_s) + expect(datatable.as_json[:data].pluck(:id)).not_to include(jane_contact.id.to_s) end end @@ -182,8 +182,8 @@ let(:search_term) { "jane@example.com" } it "returns matching case contacts" do - expect(datatable.as_json[:data].map { |d| d[:id] }).to include(jane_contact.id.to_s) - expect(datatable.as_json[:data].map { |d| d[:id] }).not_to include(john_contact.id.to_s) + expect(datatable.as_json[:data].pluck(:id)).to include(jane_contact.id.to_s) + expect(datatable.as_json[:data].pluck(:id)).not_to include(john_contact.id.to_s) end end @@ -191,8 +191,8 @@ let(:search_term) { "2024-001" } it "returns matching case contacts" do - expect(datatable.as_json[:data].map { |d| d[:id] }).to include(jane_contact.id.to_s) - expect(datatable.as_json[:data].map { |d| d[:id] }).not_to include(john_contact.id.to_s) + expect(datatable.as_json[:data].pluck(:id)).to include(jane_contact.id.to_s) + expect(datatable.as_json[:data].pluck(:id)).not_to include(john_contact.id.to_s) end end @@ -200,8 +200,8 @@ let(:search_term) { "Meeting" } it "returns matching case contacts" do - expect(datatable.as_json[:data].map { |d| d[:id] }).to include(john_contact.id.to_s) - expect(datatable.as_json[:data].map { |d| d[:id] }).not_to include(jane_contact.id.to_s) + expect(datatable.as_json[:data].pluck(:id)).to include(john_contact.id.to_s) + expect(datatable.as_json[:data].pluck(:id)).not_to include(jane_contact.id.to_s) end end @@ -209,8 +209,8 @@ let(:search_term) { "Family" } it "returns matching case contacts" do - expect(datatable.as_json[:data].map { |d| d[:id] }).to include(john_contact.id.to_s) - expect(datatable.as_json[:data].map { |d| d[:id] }).not_to include(jane_contact.id.to_s) + expect(datatable.as_json[:data].pluck(:id)).to include(john_contact.id.to_s) + expect(datatable.as_json[:data].pluck(:id)).not_to include(jane_contact.id.to_s) end end @@ -218,7 +218,7 @@ let(:search_term) { "JOHN" } it "returns matching case contacts regardless of case" do - expect(datatable.as_json[:data].map { |d| d[:id] }).to include(john_contact.id.to_s) + expect(datatable.as_json[:data].pluck(:id)).to include(john_contact.id.to_s) end end @@ -226,7 +226,7 @@ let(:search_term) { "Smi" } it "returns matching case contacts with partial match" do - expect(datatable.as_json[:data].map { |d| d[:id] }).to include(jane_contact.id.to_s) + expect(datatable.as_json[:data].pluck(:id)).to include(jane_contact.id.to_s) end end @@ -234,7 +234,7 @@ let(:search_term) { "" } it "returns all case contacts" do - expect(datatable.as_json[:data].map { |d| d[:id] }).to include(john_contact.id.to_s, jane_contact.id.to_s) + expect(datatable.as_json[:data].pluck(:id)).to include(john_contact.id.to_s, jane_contact.id.to_s) end end @@ -275,7 +275,7 @@ let(:order_direction) { "desc" } it "orders contacts by occurred_at descending" do - ids = datatable.as_json[:data].map { |d| d[:id] } + ids = datatable.as_json[:data].pluck(:id) expect(ids).to eq([recent_contact.id.to_s, old_contact.id.to_s]) end end @@ -284,7 +284,7 @@ let(:order_direction) { "asc" } it "orders contacts by occurred_at ascending" do - ids = datatable.as_json[:data].map { |d| d[:id] } + ids = datatable.as_json[:data].pluck(:id) expect(ids).to eq([old_contact.id.to_s, recent_contact.id.to_s]) end end @@ -295,7 +295,7 @@ let(:order_direction) { "desc" } it "orders contacts by contact_made" do - ids = datatable.as_json[:data].map { |d| d[:id] } + ids = datatable.as_json[:data].pluck(:id) expect(ids.first).to eq(recent_contact.id.to_s) end end @@ -305,7 +305,7 @@ let(:order_direction) { "asc" } it "orders contacts by medium_type" do - ids = datatable.as_json[:data].map { |d| d[:id] } + ids = datatable.as_json[:data].pluck(:id) expect(ids.first).to eq(recent_contact.id.to_s) end end @@ -315,7 +315,7 @@ let(:order_direction) { "desc" } it "orders contacts by duration_minutes" do - ids = datatable.as_json[:data].map { |d| d[:id] } + ids = datatable.as_json[:data].pluck(:id) expect(ids).to eq([recent_contact.id.to_s, old_contact.id.to_s]) end end diff --git a/spec/datatables/supervisor_datatable_spec.rb b/spec/datatables/supervisor_datatable_spec.rb index 5f54380a6f..63fbc9261b 100644 --- a/spec/datatables/supervisor_datatable_spec.rb +++ b/spec/datatables/supervisor_datatable_spec.rb @@ -19,8 +19,8 @@ it "brings only active supervisors", :aggregate_failures do expect(subject[:recordsTotal]).to eq(2) expect(subject[:recordsFiltered]).to eq(1) - expect(subject[:data].map { |d| d[:display_name] }).to include(CGI.escapeHTML(active_supervisor.display_name)) - expect(subject[:data].map { |d| d[:display_name] }).not_to include(CGI.escapeHTML(inactive_supervisor.display_name)) + expect(subject[:data].pluck(:display_name)).to include(CGI.escapeHTML(active_supervisor.display_name)) + expect(subject[:data].pluck(:display_name)).not_to include(CGI.escapeHTML(inactive_supervisor.display_name)) end end @@ -30,8 +30,8 @@ it "brings only inactive supervisors", :aggregate_failures do expect(subject[:recordsTotal]).to eq(2) expect(subject[:recordsFiltered]).to eq(1) - expect(subject[:data].map { |d| d[:display_name] }).to include(CGI.escapeHTML(inactive_supervisor.display_name)) - expect(subject[:data].map { |d| d[:display_name] }).not_to include(CGI.escapeHTML(active_supervisor.display_name)) + expect(subject[:data].pluck(:display_name)).to include(CGI.escapeHTML(inactive_supervisor.display_name)) + expect(subject[:data].pluck(:display_name)).not_to include(CGI.escapeHTML(active_supervisor.display_name)) end end @@ -42,8 +42,8 @@ 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(CGI.escapeHTML(active_supervisor.display_name)) - expect(subject[:data].map { |d| d[:display_name] }).to include(CGI.escapeHTML(inactive_supervisor.display_name)) + expect(subject[:data].pluck(:display_name)).to include(CGI.escapeHTML(active_supervisor.display_name)) + expect(subject[:data].pluck(:display_name)).to include(CGI.escapeHTML(inactive_supervisor.display_name)) end end diff --git a/spec/datatables/volunteer_datatable_spec.rb b/spec/datatables/volunteer_datatable_spec.rb index 4ca2e01de6..19cfe14914 100644 --- a/spec/datatables/volunteer_datatable_spec.rb +++ b/spec/datatables/volunteer_datatable_spec.rb @@ -280,7 +280,7 @@ context "when ascending" do it "is successful" do - expect(values.map { |h| h[:contacts_made_in_past_days] }).to eq ["2", "3", "", "", "", ""] + expect(values.pluck(:contacts_made_in_past_days)).to eq ["2", "3", "", "", "", ""] end end @@ -293,7 +293,7 @@ end it "is successful" do - expect(values.map { |h| h[:contacts_made_in_past_days] }).to eq ["3", "2", "", "", "", ""] + expect(values.pluck(:contacts_made_in_past_days)).to eq ["3", "2", "", "", "", ""] end it "moves blanks to the end" do @@ -342,7 +342,7 @@ it "is successful" do expect(subject[:data].length).to eq volunteers.count - expect(subject[:data].map { |d| d[:id] }.sort).to eq volunteers.map { |v| v.id.to_s }.sort + expect(subject[:data].pluck(:id).sort).to eq volunteers.map { |v| v.id.to_s }.sort end end diff --git a/spec/models/casa_org_spec.rb b/spec/models/casa_org_spec.rb index 1eccf8d7d7..cb5c093dba 100644 --- a/spec/models/casa_org_spec.rb +++ b/spec/models/casa_org_spec.rb @@ -152,7 +152,7 @@ let(:contact_topics) { ContactTopic.where(casa_org: org).map(&:question) } it "matches default contact topics" do - expected = fake_topics.map { |topic| topic["question"] } + expected = fake_topics.pluck("question") expect(contact_topics).to include(*expected) end end diff --git a/spec/models/case_court_report_context_spec.rb b/spec/models/case_court_report_context_spec.rb index 23b683f370..807c6fb44d 100644 --- a/spec/models/case_court_report_context_spec.rb +++ b/spec/models/case_court_report_context_spec.rb @@ -245,18 +245,18 @@ court_topics = build(:case_court_report_context, casa_case: casa_case).court_topics expect(court_topics.keys).to match_array(["Question 1", "Question 2", "Question 3"]) - expect(court_topics["Question 1"][:answers].map { |a| a[:value] }).to match_array( + expect(court_topics["Question 1"][:answers].pluck(:value)).to match_array( ["Answer From One Year Ago", "Answer 1", "Answer 3", "Answer From One Day Ago"] ) - expect(court_topics["Question 2"][:answers].map { |a| a[:value] }).to match_array(["Answer 2", "Answer 5"]) - expect(court_topics["Question 3"][:answers].map { |a| a[:value] }).to match_array(["No Answer Provided", "No Answer Provided"]) + expect(court_topics["Question 2"][:answers].pluck(:value)).to match_array(["Answer 2", "Answer 5"]) + expect(court_topics["Question 3"][:answers].pluck(:value)).to match_array(["No Answer Provided", "No Answer Provided"]) end it "filters by date range" do court_topics = build(:case_court_report_context, start_date: 45.day.ago.to_s, end_date: 5.day.ago.to_s, casa_case: casa_case).court_topics expect(court_topics.keys).to match_array(["Question 1", "Question 2", "Question 3"]) - expect(court_topics["Question 1"][:answers].map { |a| a[:value] }).to match_array(["Answer 1", "Answer 3"]) + expect(court_topics["Question 1"][:answers].pluck(:value)).to match_array(["Answer 1", "Answer 3"]) end it "filters answers from topics set be excluded from court report" do diff --git a/spec/models/contact_topic_spec.rb b/spec/models/contact_topic_spec.rb index dbbbda25e9..423fb51100 100644 --- a/spec/models/contact_topic_spec.rb +++ b/spec/models/contact_topic_spec.rb @@ -50,8 +50,8 @@ questions = org.contact_topics.map(&:question) details = org.contact_topics.map(&:details) - expect(questions).to match_array(topics.map { |t| t["question"] }) - expect(details).to match_array(topics.map { |t| t["details"] }) + expect(questions).to match_array(topics.pluck("question")) + expect(details).to match_array(topics.pluck("details")) end it "fails if not all required attrs are present" do diff --git a/spec/requests/all_casa_admins/casa_orgs_spec.rb b/spec/requests/all_casa_admins/casa_orgs_spec.rb index 74dfcdd45a..ac5903e951 100644 --- a/spec/requests/all_casa_admins/casa_orgs_spec.rb +++ b/spec/requests/all_casa_admins/casa_orgs_spec.rb @@ -61,8 +61,8 @@ expect { post_create }.to change(ContactTopic, :count).by(2) casa_org = CasaOrg.last - expect(casa_org.contact_topics.map(&:question)).to match_array(contact_topics.map { |t| t["question"] }) - expect(casa_org.contact_topics.map(&:details)).to match_array(contact_topics.map { |t| t["details"] }) + expect(casa_org.contact_topics.map(&:question)).to match_array(contact_topics.pluck("question")) + expect(casa_org.contact_topics.map(&:details)).to match_array(contact_topics.pluck("details")) expect(casa_org.contact_topics.pluck(:active)).to be_all true end diff --git a/spec/requests/case_contacts/case_contacts_new_design_spec.rb b/spec/requests/case_contacts/case_contacts_new_design_spec.rb index fb8f7e28b8..9aa06eeedb 100644 --- a/spec/requests/case_contacts/case_contacts_new_design_spec.rb +++ b/spec/requests/case_contacts/case_contacts_new_design_spec.rb @@ -111,7 +111,7 @@ post datatable_case_contacts_new_design_path, params: search_params, as: :json json = JSON.parse(response.body, symbolize_names: true) - ids = json[:data].map { |d| d[:id] } + ids = json[:data].pluck(:id) expect(ids).to include(searchable_contact.id.to_s) end end @@ -135,7 +135,7 @@ post datatable_case_contacts_new_design_path, params: datatable_params, as: :json json = JSON.parse(response.body, symbolize_names: true) - ids = json[:data].map { |d| d[:id] } + ids = json[:data].pluck(:id) expect(ids).to include(volunteer_contact.id.to_s) expect(ids).not_to include(other_volunteer_contact.id.to_s) @@ -162,7 +162,7 @@ post datatable_case_contacts_new_design_path, params: datatable_params, as: :json json = JSON.parse(response.body, symbolize_names: true) - ids = json[:data].map { |d| d[:id] } + ids = json[:data].pluck(:id) expect(ids).to include(contact1.id.to_s, contact2.id.to_s) end