Remove unused UpdateAnalyticsJob code (#5335) [deploy]

This commit is contained in:
Molly Struve 2020-01-03 14:22:39 -05:00 committed by Mac Siri
parent caa1738b16
commit 5f5dd528e1
2 changed files with 0 additions and 47 deletions

View file

@ -1,12 +0,0 @@
module Articles
class UpdateAnalyticsJob < ApplicationJob
queue_as :articles_update_analytics
def perform(user_id, analytics_updater = Articles::AnalyticsUpdater)
user = User.find_by(id: user_id)
return unless user
analytics_updater.call(user)
end
end
end

View file

@ -1,35 +0,0 @@
require "rails_helper"
RSpec.describe Articles::UpdateAnalyticsJob, type: :job do
include_examples "#enqueues_job", "articles_update_analytics", 456
describe "#perform_now" do
let(:article_analytics_updater_service) { class_double(Articles::AnalyticsUpdater) }
before do
allow(article_analytics_updater_service).to receive(:call)
end
context "when user_id a real user" do
before do
allow(User).to receive(:find_by).and_return(456)
end
it "calls the service" do
described_class.perform_now(456, article_analytics_updater_service)
expect(article_analytics_updater_service).to have_received(:call).with(456)
end
end
context "when user_id not a real user" do
before do
allow(User).to receive(:find_by)
end
it "does not call the service" do
described_class.perform_now(456, article_analytics_updater_service)
expect(article_analytics_updater_service).not_to have_received(:call)
end
end
end
end