-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ClientHelper / SpecHelper improvement with source generation tests (#267
- Loading branch information
Showing
31 changed files
with
1,127 additions
and
872 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
# frozen_string_literal: true | ||
|
||
describe 'Component: Client', rbs_test: true do | ||
before(:all) do | ||
@tmpdir = SpecHelper.generate(['Weather'], :client) | ||
end | ||
describe 'Client: Client' do | ||
['generated client gem', 'generated client from source code'].each do |context| | ||
next if ENV['SMITHY_RUBY_RBS_TEST'] && context != 'generated client gem' | ||
|
||
after(:all) do | ||
SpecHelper.cleanup(['Weather'], @tmpdir) | ||
end | ||
context context do | ||
include_context context, fixture: 'weather' | ||
|
||
subject { Weather::Client.new } | ||
subject { Weather::Client.new(endpoint: 'https://example.com') } | ||
|
||
# it 'adds the HTTP plugin' do | ||
# expect(Weather::Client.plugins).to include(Smithy::Client::Plugins::NetHTTP) | ||
# end | ||
it 'loads plugins' do | ||
expect(Weather::Client.plugins).to include(Smithy::Client::Plugins::NetHTTP) | ||
end | ||
|
||
it 'has operation methods' do | ||
expect(subject).to respond_to(:get_city, :get_current_time, :get_forecast, :list_cities) | ||
end | ||
it 'has operation methods' do | ||
expect(subject).to respond_to(:get_city, :get_current_time, :get_forecast, :list_cities) | ||
end | ||
|
||
it 'builds input for operations' do | ||
input = subject.send(:build_input, :get_city, { id: 1 }) | ||
expect(input).to be_a(Smithy::Client::Input) | ||
end | ||
it 'builds input for operations' do | ||
input = subject.send(:build_input, :get_city, { id: 1 }) | ||
expect(input).to be_a(Smithy::Client::Input) | ||
end | ||
|
||
# it 'can call operations' do | ||
# subject.get_city(id: 1) | ||
# end | ||
# it 'can call operations' do | ||
# subject.get_city(city_id: '1') | ||
# end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
describe 'Component: Customizations' do | ||
before(:all) do | ||
@tmpdir = SpecHelper.generate(['Weather'], :client) | ||
end | ||
|
||
after(:all) do | ||
SpecHelper.cleanup(['Weather'], @tmpdir) | ||
end | ||
|
||
subject { Weather::Client.new(endpoint: 'https://example.com') } | ||
|
||
it 'should have a customizations file' do | ||
expect(File).to exist(File.join(@tmpdir, 'lib', 'weather', 'customizations.rb')) | ||
end | ||
|
||
it 'should require the customizations file' do | ||
expect(require('weather/customizations')).to eq(false) | ||
end | ||
|
||
it 'does not overwrite an existing customizations file' do | ||
customization = <<~RUBY | ||
module Weather | ||
# @api private | ||
module Customizations; end | ||
end | ||
RUBY | ||
customizations_file = File.join(@tmpdir, 'lib', 'weather', 'customizations.rb') | ||
expect(File.read(customizations_file)).to_not include(customization) | ||
File.write(customizations_file, customization) | ||
SpecHelper.generate(['Weather'], :client, destination_root: @tmpdir) | ||
expect(File.read(customizations_file)).to include(customization) | ||
end | ||
describe 'Client: Customizations' do | ||
include_examples 'customizations', 'generated client gem' | ||
end |
114 changes: 57 additions & 57 deletions
114
gems/smithy/spec/interfaces/client/endpoint_parameters_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.