From 099f3f313de1a81a2654378af839354a4cd9f979 Mon Sep 17 00:00:00 2001 From: moveson Date: Tue, 17 Dec 2024 10:33:32 -0700 Subject: [PATCH 1/2] Require ostruct in DeleteTopicResourceKeyJob This is a change resulting from the move to Ruby 3.3 --- app/jobs/delete_topic_resource_key_job.rb | 2 ++ .../delete_topic_resource_key_job_spec.rb | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 spec/jobs/delete_topic_resource_key_job_spec.rb diff --git a/app/jobs/delete_topic_resource_key_job.rb b/app/jobs/delete_topic_resource_key_job.rb index 8f614109f..7d898eace 100644 --- a/app/jobs/delete_topic_resource_key_job.rb +++ b/app/jobs/delete_topic_resource_key_job.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require "ostruct" + class DeleteTopicResourceKeyJob < ApplicationJob queue_as :default diff --git a/spec/jobs/delete_topic_resource_key_job_spec.rb b/spec/jobs/delete_topic_resource_key_job_spec.rb new file mode 100644 index 000000000..01ef4c097 --- /dev/null +++ b/spec/jobs/delete_topic_resource_key_job_spec.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +require "rails_helper" + +RSpec.describe DeleteTopicResourceKeyJob do + subject { described_class.new } + + let(:topic_resource_key) { "arn:aws:sns:test" } + + describe "#perform" do + let(:perform_job) { subject.perform(topic_resource_key) } + let(:expected_mock_resource) { OpenStruct.new(topic_resource_key: topic_resource_key, slug: topic_resource_key) } + + before { allow(SnsTopicManager).to receive(:delete) } + + it "sends a message to the topic manager" do + expect(SnsTopicManager).to receive(:delete).with(resource: expected_mock_resource) + perform_job + end + end +end From f8ec6fff0ffdf102d76f60a3d2e812693212ac25 Mon Sep 17 00:00:00 2001 From: moveson Date: Tue, 17 Dec 2024 10:35:32 -0700 Subject: [PATCH 2/2] Require ostruct in other files that use OpenStruct --- app/models/proto_record.rb | 1 + app/services/find_not_expected_bibs.rb | 2 ++ lib/etl/extractors/csv_file_strategy.rb | 1 + 3 files changed, 4 insertions(+) diff --git a/app/models/proto_record.rb b/app/models/proto_record.rb index a4c2275d9..c7cd9dead 100644 --- a/app/models/proto_record.rb +++ b/app/models/proto_record.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require "etl/etl" +require "ostruct" class ProtoRecord include ETL::Transformable diff --git a/app/services/find_not_expected_bibs.rb b/app/services/find_not_expected_bibs.rb index 1cb62cbf0..9a587cafa 100644 --- a/app/services/find_not_expected_bibs.rb +++ b/app/services/find_not_expected_bibs.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require "ostruct" + class FindNotExpectedBibs include Interactors::Errors include SplitAnalyzable diff --git a/lib/etl/extractors/csv_file_strategy.rb b/lib/etl/extractors/csv_file_strategy.rb index 7bd1397aa..a11c64430 100644 --- a/lib/etl/extractors/csv_file_strategy.rb +++ b/lib/etl/extractors/csv_file_strategy.rb @@ -2,6 +2,7 @@ require "smarter_csv" require "csv" +require "ostruct" module ETL module Extractors