Skip to content

Commit

Permalink
Update based on feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jterapin committed Aug 8, 2024
1 parent 3b76037 commit 7477894
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions gems/aws-sdk-core/spec/aws/temp_waiters_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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|
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7477894

Please sign in to comment.