mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-03-15 23:20:01 +01:00
Test ShareWorker
's handling of deleted records
This commit is contained in:
parent
9c599db3a7
commit
0b926a43e4
1 changed files with 26 additions and 0 deletions
26
spec/workers/share_worker_spec.rb
Normal file
26
spec/workers/share_worker_spec.rb
Normal file
|
@ -0,0 +1,26 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
describe ShareWorker do
|
||||
let(:user) { FactoryBot.create(:user) }
|
||||
let(:answer) { FactoryBot.create(:answer, user: user) }
|
||||
|
||||
describe "#perform" do
|
||||
subject { ShareWorker.new.perform(user.id, answer.id, 'twitter') }
|
||||
|
||||
before do
|
||||
Service.create!(type: 'Services::Twitter',
|
||||
user: user)
|
||||
end
|
||||
|
||||
context 'when answer doesn\'t exist' do
|
||||
it 'prevents the job from retrying and logs a message' do
|
||||
answer.destroy!
|
||||
Sidekiq.logger.should_receive(:info)
|
||||
subject
|
||||
expect(ShareWorker.jobs.size).to eq(0)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue