Requeue expiration notification (#24311)

This commit is contained in:
Christian Schmidt
2023-03-29 10:52:40 +02:00
committed by GitHub
parent c384795731
commit eb38e9df31
4 changed files with 71 additions and 5 deletions

View File

@ -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