From 099f3f313de1a81a2654378af839354a4cd9f979 Mon Sep 17 00:00:00 2001 From: moveson Date: Tue, 17 Dec 2024 10:33:32 -0700 Subject: [PATCH] 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