From b179dadce65acec9a7719f8fcd55c300a11a906d Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Thu, 4 Nov 2021 11:25:32 +0100 Subject: [PATCH] Mock CodeOcean::Config for Poseidon strategy --- spec/lib/runner/strategy/poseidon_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spec/lib/runner/strategy/poseidon_spec.rb b/spec/lib/runner/strategy/poseidon_spec.rb index fb31429b..42ec928e 100644 --- a/spec/lib/runner/strategy/poseidon_spec.rb +++ b/spec/lib/runner/strategy/poseidon_spec.rb @@ -9,6 +9,16 @@ describe Runner::Strategy::Poseidon do let(:error_message) { 'test error message' } let(:response_body) { nil } + let(:codeocean_config) { instance_double(CodeOcean::Config) } + let(:runner_management_config) { {runner_management: {enabled: true, strategy: :poseidon, url: 'https://runners.example.org', unused_runner_expiration_time: 180}} } + + before do + # Ensure to reset the memorized helper + Runner.instance_variable_set :@strategy_class, nil + allow(CodeOcean::Config).to receive(:new).with(:code_ocean).and_return(codeocean_config) + allow(codeocean_config).to receive(:read).and_return(runner_management_config) + end + # All requests handle a BadRequest (400) response the same way. shared_examples 'BadRequest (400) error handling' do context 'when Poseidon returns BadRequest (400)' do