From d85f847c3d78986b5002bbdfbd633d8ab4a07b15 Mon Sep 17 00:00:00 2001 From: Jon Roberts Date: Tue, 12 Nov 2024 15:42:09 -0500 Subject: [PATCH] remove some warning ran rspec with --warnings flag and fixed most of them in our code --- app/services/followup_service.rb | 4 +--- app/views/case_contacts/form/details.html.erb | 1 - spec/services/placement_export_csv_service_spec.rb | 2 +- spec/support/capybara.rb | 9 +-------- spec/support/pretender_context.rb | 4 ++++ spec/views/layouts/header.html.erb_spec.rb | 5 ----- spec/views/layouts/sidebar.html.erb_spec.rb | 5 ----- 7 files changed, 7 insertions(+), 23 deletions(-) create mode 100644 spec/support/pretender_context.rb diff --git a/app/services/followup_service.rb b/app/services/followup_service.rb index ddce20a01c..50dc805e5e 100644 --- a/app/services/followup_service.rb +++ b/app/services/followup_service.rb @@ -16,9 +16,7 @@ def self.create_followup(case_contact, creator, note) followup end - private_class_method - - def self.send_notification(followup, creator) + private_class_method def self.send_notification(followup, creator) FollowupNotifier .with(followup: followup, created_by: creator) .deliver(followup.case_contact.creator) diff --git a/app/views/case_contacts/form/details.html.erb b/app/views/case_contacts/form/details.html.erb index 6c96adb9e0..525ee662a3 100644 --- a/app/views/case_contacts/form/details.html.erb +++ b/app/views/case_contacts/form/details.html.erb @@ -54,7 +54,6 @@ <% min_date = CaseContact::MINIMUM_DATE %> <% current_date = Time.zone.today %> - <% initial_value = @case_contact.occurred_at&.to_date %> <%= form.date_field(:occurred_at, required: true, max: (current_date + 1.day).to_fs(:iso8601), diff --git a/spec/services/placement_export_csv_service_spec.rb b/spec/services/placement_export_csv_service_spec.rb index dd2d986820..ab84e37c7f 100644 --- a/spec/services/placement_export_csv_service_spec.rb +++ b/spec/services/placement_export_csv_service_spec.rb @@ -6,7 +6,7 @@ casa_org = create(:casa_org, name: "Fake Name", display_name: "Fake Display Name") placement_type = create(:placement_type, casa_org: casa_org) creator = create(:user) - placement = create(:placement, creator: creator, placement_type: placement_type) # rubocop:disable Lint/UselessAssignment + create(:placement, creator: creator, placement_type: placement_type) csv_headers = "Casa Org,Casa Case Number,Placement Type,Placement Started At,Created At,Creator Name\n" result = PlacementExportCsvService.new(casa_org: casa_org).perform diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb index 4ed308b033..4fd304e527 100644 --- a/spec/support/capybara.rb +++ b/spec/support/capybara.rb @@ -15,14 +15,7 @@ Capybara.disable_animation = true Capybara::Screenshot.autosave_on_failure = true - -module Capybara - module Screenshot - def self.capybara_tmp_path - Rails.root.join("tmp", "screenshots#{ENV["GROUPS_UNDERSCORE"]}") - end - end -end +Capybara.save_path = Rails.root.join("tmp", "screenshots#{ENV["GROUPS_UNDERSCORE"]}") options = Selenium::WebDriver::Chrome::Options.new options.add_argument("--disable-gpu") diff --git a/spec/support/pretender_context.rb b/spec/support/pretender_context.rb new file mode 100644 index 0000000000..67b2077720 --- /dev/null +++ b/spec/support/pretender_context.rb @@ -0,0 +1,4 @@ +module PretenderContext + def true_user + end +end diff --git a/spec/views/layouts/header.html.erb_spec.rb b/spec/views/layouts/header.html.erb_spec.rb index d30dd4ebf1..a14821ca87 100644 --- a/spec/views/layouts/header.html.erb_spec.rb +++ b/spec/views/layouts/header.html.erb_spec.rb @@ -1,10 +1,5 @@ require "rails_helper" -module PretenderContext - def true_user - end -end - RSpec.describe "layout/header", type: :view do before do view.class.include PretenderContext diff --git a/spec/views/layouts/sidebar.html.erb_spec.rb b/spec/views/layouts/sidebar.html.erb_spec.rb index c320c7881c..0abdcac489 100644 --- a/spec/views/layouts/sidebar.html.erb_spec.rb +++ b/spec/views/layouts/sidebar.html.erb_spec.rb @@ -1,10 +1,5 @@ require "rails_helper" -module PretenderContext - def true_user - end -end - RSpec.describe "layout/sidebar", type: :view do before do view.class.include PretenderContext