Remove Comments::CreateIdCodeJob which is now done inline (#5536)

This commit is contained in:
Molly Struve 2020-01-16 09:31:11 -05:00 committed by GitHub
parent b89ebd133e
commit 29efdaf20a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 0 additions and 42 deletions

View file

@ -1,11 +0,0 @@
module Comments
class CreateIdCodeJob < ApplicationJob
queue_as :comments_create_id_code
def perform(comment_id)
comment = Comment.find_by(id: comment_id)
comment&.update_column(:id_code, comment.id.to_s(26))
end
end
end

View file

@ -7,11 +7,5 @@ FactoryBot.define do
factory :article_comment do
association :commentable, factory: :article
end
trait :with_path do
after(:create) do |comment|
Comments::CreateIdCodeJob.perform_now(comment.id)
end
end
end
end

View file

@ -1,24 +0,0 @@
require "rails_helper"
RSpec.describe Comments::CreateIdCodeJob, type: :job do
include_examples "#enqueues_job", "comments_create_id_code", 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 an id code" do
described_class.perform_now(comment.id)
expect(comment.reload.id_code).to eq(comment.id.to_s(26))
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

View file

@ -6,7 +6,6 @@ RSpec.describe "Editing A Comment", type: :system, js: true do
let(:new_comment_text) { Faker::Lorem.paragraph }
let!(:comment) do
create(:comment,
:with_path,
commentable: article,
user: user,
body_markdown: Faker::Lorem.paragraph)