diff --git a/app/jobs/notifications/notifiable_action_job.rb b/app/jobs/notifications/notifiable_action_job.rb deleted file mode 100644 index 7afa3abfb..000000000 --- a/app/jobs/notifications/notifiable_action_job.rb +++ /dev/null @@ -1,13 +0,0 @@ -module Notifications - class NotifiableActionJob < ApplicationJob - queue_as :send_notifiable_action_notification - - def perform(notifiable_id, notifiable_type, action, service = Notifications::NotifiableAction::Send) - # checking type, but leaving space for notifyable types - return unless notifiable_type == "Article" - - notifiable = notifiable_type.constantize.find_by(id: notifiable_id) - service.call(notifiable, action) if notifiable - end - end -end diff --git a/spec/jobs/notifications/notifiable_action_job_spec.rb b/spec/jobs/notifications/notifiable_action_job_spec.rb deleted file mode 100644 index 95ae6eafd..000000000 --- a/spec/jobs/notifications/notifiable_action_job_spec.rb +++ /dev/null @@ -1,30 +0,0 @@ -require "rails_helper" - -RSpec.describe Notifications::NotifiableActionJob, type: :job do - include_examples "#enqueues_job", "send_notifiable_action_notification", 5 - - describe "#perform_now" do - let(:service) { double } - - before do - allow(service).to receive(:call) - end - - it "calls the service when existing notifiable passed" do - notifiable = create(:article) - described_class.perform_now(notifiable.id, "Article", "Published", service) - expect(service).to have_received(:call).with(notifiable, "Published").once - end - - it "doesn't call a service when notifiable doesn't exist" do - described_class.perform_now(Article.maximum(:id).to_i + 1, "Article", "Published", service) - expect(service).not_to have_received(:call) - end - - it "doesn't call a service when unexpected notifiable type passed" do - user = create(:user) - described_class.perform_now(user.id, "User", "Upgraded", service) - expect(service).not_to have_received(:call) - end - end -end