Adjust `ShareWorker` test to not be dependent on config options
This commit is contained in:
parent
9dafa675d1
commit
45dae78ed0
|
@ -8,6 +8,20 @@ describe ShareWorker do
|
||||||
let!(:service) { Services::Twitter.create!(type: 'Services::Twitter',
|
let!(:service) { Services::Twitter.create!(type: 'Services::Twitter',
|
||||||
user: user) }
|
user: user) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
stub_const("APP_CONFIG", {
|
||||||
|
'hostname' => 'example.com',
|
||||||
|
'anonymous_name' => 'Anonymous',
|
||||||
|
'https' => true,
|
||||||
|
'items_per_page' => 5,
|
||||||
|
'sharing' => {
|
||||||
|
'twitter' => {
|
||||||
|
'consumer_key' => '',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
describe "#perform" do
|
describe "#perform" do
|
||||||
subject {
|
subject {
|
||||||
Sidekiq::Testing.fake! do
|
Sidekiq::Testing.fake! do
|
||||||
|
@ -27,7 +41,7 @@ describe ShareWorker do
|
||||||
context 'when answer exists' do
|
context 'when answer exists' do
|
||||||
it 'retries on unhandled exceptions' do
|
it 'retries on unhandled exceptions' do
|
||||||
expect { subject }.to change(ShareWorker.jobs, :size).by(1)
|
expect { subject }.to change(ShareWorker.jobs, :size).by(1)
|
||||||
expect { ShareWorker.drain }.to raise_error(Twitter::Error::Forbidden)
|
expect { ShareWorker.drain }.to raise_error(Twitter::Error::BadRequest)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue