diff --git a/gems/aws-sdk-core/spec/aws/temp_waiters_spec.rb b/gems/aws-sdk-core/spec/aws/temp_waiters_spec.rb index 21c50ff017f..0b0af9143b2 100644 --- a/gems/aws-sdk-core/spec/aws/temp_waiters_spec.rb +++ b/gems/aws-sdk-core/spec/aws/temp_waiters_spec.rb @@ -13,14 +13,6 @@ module Waiters let(:client) { WaiterTest::Client.new(stub_responses: true) } - let(:setup_stub_resp) do - client.stub_responses(:waiter_operation, table: { table_status: 'ACTIVE' }) - end - - let(:setup_stub_resp_error) do - client.stub_responses(:waiter_operation, 'ResourceNotFoundException') - end - describe 'unknown waiters' do it 'raises an error when attempting to wait for an unknown state' do expect do @@ -73,7 +65,7 @@ module Waiters end it 'triggers callbacks before sending and before waiting' do - setup_stub_resp_error + client.stub_responses(:waiter_operation, 'ResourceNotFoundException') yielded = [] expect do client.wait_until(:generic_waiter) do |w| @@ -97,19 +89,19 @@ module Waiters end it 'returns when successful' do - setup_stub_resp + client.stub_responses(:waiter_operation, table: { table_status: 'ACTIVE' }) expect { client.wait_until(:generic_waiter) } .not_to raise_error end it 'returns the client response' do - setup_stub_resp + client.stub_responses(:waiter_operation, table: { table_status: 'ACTIVE' }) resp = client.wait_until(:generic_waiter) expect(resp.table.table_status).to eq('ACTIVE') end it 'raises an error when failed' do - setup_stub_resp_error + client.stub_responses(:waiter_operation, 'ResourceNotFoundException') expect do client.wait_until(:generic_waiter, {}, delay: 0) end.to raise_error(Errors::WaiterFailed) @@ -215,7 +207,7 @@ module Waiters describe 'error matcher' do context 'expected is an error code' do it 'succeeds when matched' do - setup_stub_resp_error + client.stub_responses(:waiter_operation, 'ResourceNotFoundException') expect { client.wait_until(:error_matcher_with_error_code) } .not_to raise_error end @@ -246,7 +238,7 @@ module Waiters end it 'fails when matched' do - setup_stub_resp + client.stub_responses(:waiter_operation, table: { table_status: 'ACTIVE' }) expect { client.wait_until(:error_matcher_with_false_fails) } .to raise_error(Errors::WaiterFailed) end