Remove old create first reaction job (#5347) [deploy]

This job was replaced by the worker with the same name as the suffix
Worker instead of Job, it was kept to run the existing jobs before it
can be fully removed
This commit is contained in:
Pablo Ifrán 2020-01-03 14:40:48 -03:00 committed by Molly Struve
parent cb48e431d2
commit 5e9376e955
2 changed files with 0 additions and 42 deletions

View file

@ -1,12 +0,0 @@
module Comments
class CreateFirstReactionJob < ApplicationJob
queue_as :comments_create_first_reaction
def perform(comment_id)
comment = Comment.find_by(id: comment_id)
return unless comment
Reaction.create(user_id: comment.user_id, reactable_id: comment.id, reactable_type: "Comment", category: "like")
end
end
end

View file

@ -1,30 +0,0 @@
require "rails_helper"
RSpec.describe Comments::CreateFirstReactionJob, type: :job do
include_examples "#enqueues_job", "comments_create_first_reaction", 1
describe "#perform_now" do
context "with comment" do
let_it_be(:article) { create(:article) }
let_it_be(:comment) { create(:comment, commentable: article) }
it "creates a first reaction" do
expect do
described_class.perform_now(comment.id)
end.to change(comment.reactions, :count).by(1)
end
it "creates a like reaction" do
described_class.perform_now(comment.id)
expect(comment.reactions.last.category).to eq("like")
end
end
context "without comment" do
it "does not break" do
expect { described_class.perform_now(nil) }.not_to raise_error
end
end
end
end