question/create_followers: fix incrementing asked_count

This commit is contained in:
Georg Gadinger 2023-01-02 09:20:59 +01:00
parent 9b5470cfd3
commit 9d38292d4a
2 changed files with 5 additions and 1 deletions

View File

@ -29,7 +29,7 @@ module UseCase
private private
def increment_asked_count def increment_asked_count
source_user.increment(:asked_count) source_user.increment!(:asked_count)
end end
def source_user def source_user

View File

@ -23,5 +23,9 @@ describe UseCase::Question::CreateFollowers do
it "enqueues a QuestionWorker job" do it "enqueues a QuestionWorker job" do
expect(QuestionWorker).to have_enqueued_sidekiq_job(source_user.id, subject[:resource].id) expect(QuestionWorker).to have_enqueued_sidekiq_job(source_user.id, subject[:resource].id)
end end
it "increments the asked count" do
expect { subject }.to change { source_user.reload.asked_count }.by(1)
end
end end
end end