diff --git a/lib/use_case/question/create_followers.rb b/lib/use_case/question/create_followers.rb index b74517e5..21c2e89d 100644 --- a/lib/use_case/question/create_followers.rb +++ b/lib/use_case/question/create_followers.rb @@ -30,6 +30,7 @@ module UseCase def increment_asked_count source_user.increment(:asked_count) + source_user.save end def source_user diff --git a/spec/lib/use_case/question/create_followers_spec.rb b/spec/lib/use_case/question/create_followers_spec.rb index 19e91de3..7b3e2d75 100644 --- a/spec/lib/use_case/question/create_followers_spec.rb +++ b/spec/lib/use_case/question/create_followers_spec.rb @@ -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