Merge pull request #892 from Retrospring/bugfix/asked-count
question/create_followers: fix incrementing asked_count
This commit is contained in:
commit
7e1b64d1ba
|
@ -30,6 +30,7 @@ module UseCase
|
||||||
|
|
||||||
def increment_asked_count
|
def increment_asked_count
|
||||||
source_user.increment(:asked_count)
|
source_user.increment(:asked_count)
|
||||||
|
source_user.save
|
||||||
end
|
end
|
||||||
|
|
||||||
def source_user
|
def source_user
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue