about summary refs log tree commit diff
path: root/spec/services
diff options
context:
space:
mode:
authorChristian Schmidt <github@chsc.dk>2023-03-29 10:52:40 +0200
committerGitHub <noreply@github.com>2023-03-29 10:52:40 +0200
commiteb38e9df3129c2bc5ec3ecd1656336bf813747ce (patch)
treed7bcd6afef91c6db3abc62442eb608067b8e62c7 /spec/services
parentc384795731934963f309d608a4be92977889fb82 (diff)
Requeue expiration notification (#24311)
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/update_status_service_spec.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/spec/services/update_status_service_spec.rb b/spec/services/update_status_service_spec.rb
index e52a0e52b..d6923722a 100644
--- a/spec/services/update_status_service_spec.rb
+++ b/spec/services/update_status_service_spec.rb
@@ -120,7 +120,9 @@ RSpec.describe UpdateStatusService, type: :service do
     before do
       status.update(poll: poll)
       VoteService.new.call(voter, poll, [0])
-      subject.call(status, status.account_id, text: 'Foo', poll: { options: %w(Bar Baz Foo), expires_in: 5.days.to_i })
+      Sidekiq::Testing.fake! do
+        subject.call(status, status.account_id, text: 'Foo', poll: { options: %w(Bar Baz Foo), expires_in: 5.days.to_i })
+      end
     end
 
     it 'updates poll' do
@@ -138,6 +140,11 @@ RSpec.describe UpdateStatusService, type: :service do
     it 'saves edit history' do
       expect(status.edits.pluck(:poll_options)).to eq [%w(Foo Bar), %w(Bar Baz Foo)]
     end
+
+    it 'requeues expiration notification' do
+      poll = status.poll.reload
+      expect(PollExpirationNotifyWorker).to have_enqueued_sidekiq_job(poll.id).at(poll.expires_at + 5.minutes)
+    end
   end
 
   context 'when mentions in text change' do