Merge pull request #892 from Retrospring/bugfix/asked-count

question/create_followers: fix incrementing asked_count
This commit is contained in:
Georg Gadinger 2023-01-02 08:28:23 +00:00 committed by GitHub
commit 7e1b64d1ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -30,6 +30,7 @@ module UseCase
def increment_asked_count
source_user.increment(:asked_count)
source_user.save
end
def source_user

View File

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