Refactor sync_environment methods
* Add delete_environment method * Change return value to allow raising an exception
This commit is contained in:
@ -141,11 +141,11 @@ describe Runner::Strategy::Poseidon do
|
||||
end
|
||||
|
||||
shared_examples 'returns false when the api request failed' do |status|
|
||||
it "returns false on status #{status}" do
|
||||
it "raises an exception on status #{status}" do
|
||||
faraday_connection = instance_double 'Faraday::Connection'
|
||||
allow(described_class).to receive(:http_connection).and_return(faraday_connection)
|
||||
allow(faraday_connection).to receive(:put).and_return(Faraday::Response.new(status: status))
|
||||
expect(action.call).to be_falsey
|
||||
expect { action.call }.to raise_exception Runner::Error::UnexpectedResponse
|
||||
end
|
||||
end
|
||||
|
||||
@ -157,11 +157,11 @@ describe Runner::Strategy::Poseidon do
|
||||
include_examples 'returns false when the api request failed', status
|
||||
end
|
||||
|
||||
it 'returns false if Faraday raises an error' do
|
||||
it 'raises an exception if Faraday raises an error' do
|
||||
faraday_connection = instance_double 'Faraday::Connection'
|
||||
allow(described_class).to receive(:http_connection).and_return(faraday_connection)
|
||||
allow(faraday_connection).to receive(:put).and_raise(Faraday::TimeoutError)
|
||||
expect(action.call).to be_falsey
|
||||
expect { action.call }.to raise_exception Runner::Error::FaradayError
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user