Remove Comments::CreateIdCodeJob which is now done inline (#5536)
This commit is contained in:
parent
b89ebd133e
commit
29efdaf20a
4 changed files with 0 additions and 42 deletions
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue