From 45dae78ed01a8e3bed2dc67246900128f27c02a7 Mon Sep 17 00:00:00 2001 From: Karina Kwiatek Date: Tue, 28 Dec 2021 03:03:59 +0100 Subject: [PATCH] Adjust `ShareWorker` test to not be dependent on config options --- spec/workers/share_worker_spec.rb | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/spec/workers/share_worker_spec.rb b/spec/workers/share_worker_spec.rb index 988d5300..1100f5a3 100644 --- a/spec/workers/share_worker_spec.rb +++ b/spec/workers/share_worker_spec.rb @@ -8,6 +8,20 @@ describe ShareWorker do let!(:service) { Services::Twitter.create!(type: 'Services::Twitter', 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 subject { Sidekiq::Testing.fake! do @@ -27,7 +41,7 @@ describe ShareWorker do context 'when answer exists' do it 'retries on unhandled exceptions' do 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