Worker specs coverage increase (#32541)
This commit is contained in:
parent
bd0c826a3d
commit
d1b20ea8f7
8 changed files with 186 additions and 15 deletions
|
@ -6,11 +6,31 @@ RSpec.describe PushUpdateWorker do
|
|||
let(:worker) { described_class.new }
|
||||
|
||||
describe 'perform' do
|
||||
it 'runs without error for missing record' do
|
||||
account_id = nil
|
||||
status_id = nil
|
||||
context 'with missing values' do
|
||||
it 'runs without error' do
|
||||
expect { worker.perform(nil, nil) }
|
||||
.to_not raise_error
|
||||
end
|
||||
end
|
||||
|
||||
expect { worker.perform(account_id, status_id) }.to_not raise_error
|
||||
context 'with valid records' do
|
||||
let(:account) { Fabricate :account }
|
||||
let(:status) { Fabricate :status }
|
||||
|
||||
before { allow(redis).to receive(:publish) }
|
||||
|
||||
it 'pushes message to timeline' do
|
||||
expect { worker.perform(account.id, status.id) }
|
||||
.to_not raise_error
|
||||
|
||||
expect(redis)
|
||||
.to have_received(:publish)
|
||||
.with(redis_key, anything)
|
||||
end
|
||||
|
||||
def redis_key
|
||||
"timeline:#{account.id}"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue