Skip to content

Commit 0f87e18

Browse files
author
Matt Muller
committed
Minor formatting of specs
1 parent da01ac9 commit 0f87e18

6 files changed

Lines changed: 68 additions & 27 deletions

File tree

gems/smithy-client/spec/smithy-client/plugins/checksum_required_spec.rb

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,20 @@ module Plugins
1010
describe ChecksumRequired do
1111
let(:shapes) { ClientHelper.sample_shapes }
1212
let(:sample_client) { ClientHelper.sample_client(shapes: shapes) }
13-
let(:client_class) { sample_client.const_get(:Client) }
13+
14+
let(:client_class) do
15+
client_class = sample_client.const_get(:Client)
16+
client_class.clear_plugins
17+
client_class.add_plugin(sample_client::Plugins::Auth)
18+
client_class.add_plugin(sample_client::Plugins::Endpoint)
19+
client_class.add_plugin(AnonymousAuth)
20+
client_class.add_plugin(ChecksumRequired)
21+
client_class.add_plugin(Protocol)
22+
client_class.add_plugin(SignRequests)
23+
client_class.add_plugin(StubResponses)
24+
client_class
25+
end
26+
1427
let(:client) { client_class.new(stub_responses: true) }
1528

1629
before do

gems/smithy-client/spec/smithy-client/plugins/host_prefix_spec.rb

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,17 @@ module Plugins
1010
describe HostPrefix do
1111
let(:shapes) { ClientHelper.sample_shapes }
1212
let(:sample_client) { ClientHelper.sample_client(shapes: shapes) }
13-
let(:client_class) { sample_client.const_get(:Client) }
13+
14+
let(:client_class) do
15+
client_class = sample_client.const_get(:Client)
16+
client_class.clear_plugins
17+
client_class.add_plugin(sample_client::Plugins::Endpoint)
18+
client_class.add_plugin(HostPrefix)
19+
client_class.add_plugin(Protocol)
20+
client_class.add_plugin(StubResponses)
21+
client_class
22+
end
23+
1424
let(:client) { client_class.new(stub_responses: true) }
1525

1626
it 'adds a :disable_host_prefix_injection option to config' do
@@ -39,7 +49,7 @@ module Plugins
3949
expect(client.config.disable_host_prefix_injection).to be(true)
4050
end
4151

42-
context 'handler' do
52+
context 'host prefixing' do
4353
before do
4454
shapes['smithy.ruby.tests#Structure']['members']['string'] = {
4555
'target' => 'smithy.api#String',

gems/smithy-client/spec/smithy-client/plugins/idempotency_token_spec.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,17 @@ module Plugins
1010
describe IdempotencyToken do
1111
let(:shapes) { ClientHelper.sample_shapes }
1212
let(:sample_client) { ClientHelper.sample_client(shapes: shapes) }
13-
let(:client_class) { sample_client.const_get(:Client) }
13+
14+
let(:client_class) do
15+
client_class = sample_client.const_get(:Client)
16+
client_class.clear_plugins
17+
client_class.add_plugin(sample_client::Plugins::Endpoint)
18+
client_class.add_plugin(IdempotencyToken)
19+
client_class.add_plugin(Protocol)
20+
client_class.add_plugin(StubResponses)
21+
client_class
22+
end
23+
1424
let(:client) { client_class.new(stub_responses: true) }
1525

1626
before do

gems/smithy-client/spec/smithy-client/plugins/net_http_spec.rb

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,26 @@ module Plugins
1616
end
1717

1818
it 'adds net http options' do
19-
options = {
20-
# Connections
21-
http_continue_timeout: 1,
22-
http_keep_alive_timeout: 1,
23-
http_open_timeout: 1,
24-
http_read_timeout: 1,
25-
http_ssl_timeout: 1,
26-
http_write_timeout: 1,
27-
# Security
28-
http_ca_file: 'file',
29-
http_ca_path: 'path/to/files',
30-
http_cert: 'cert',
31-
http_cert_store: 'store',
32-
http_key: 'key',
33-
http_verify_mode: OpenSSL::SSL::VERIFY_NONE,
34-
# Debugging
35-
http_debug_output: true,
36-
# Proxies
37-
http_proxy: 'http://proxy.com:123'
38-
}
39-
client_class.new(options)
19+
options = %i[
20+
http_continue_timeout
21+
http_keep_alive_timeout
22+
http_open_timeout
23+
http_read_timeout
24+
http_ssl_timeout
25+
http_write_timeout
26+
http_ca_file
27+
http_ca_path
28+
http_cert
29+
http_cert_store
30+
http_key
31+
http_verify_mode
32+
http_debug_output
33+
http_proxy
34+
]
35+
client = client_class.new
36+
options.each do |option|
37+
expect(client.config).to respond_to(option)
38+
end
4039
end
4140
end
4241
end

gems/smithy-client/spec/smithy-client/plugins/request_compression_spec.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,17 @@ module Plugins
1010
describe RequestCompression do
1111
let(:shapes) { ClientHelper.sample_shapes }
1212
let(:sample_client) { ClientHelper.sample_client(shapes: shapes) }
13-
let(:client_class) { sample_client.const_get(:Client) }
13+
14+
let(:client_class) do
15+
client_class = sample_client.const_get(:Client)
16+
client_class.clear_plugins
17+
client_class.add_plugin(sample_client::Plugins::Endpoint)
18+
client_class.add_plugin(RequestCompression)
19+
client_class.add_plugin(Protocol)
20+
client_class.add_plugin(StubResponses)
21+
client_class
22+
end
23+
1424
let(:client) { client_class.new(stub_responses: true) }
1525

1626
it 'adds a :disable_request_compression option to config' do

gems/smithy-client/spec/spec_helper.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
require_relative 'support/client_helper'
1616

17-
# TODO: remove this?
1817
class DummySendPlugin < Smithy::Client::Plugin
1918
class Handler < Smithy::Client::Handler
2019
def call(context)

0 commit comments

Comments
 (0)