-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathgemspec_examples.rb
More file actions
67 lines (59 loc) · 2.51 KB
/
gemspec_examples.rb
File metadata and controls
67 lines (59 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# frozen_string_literal: true
RSpec.shared_examples 'gemspec' do |context|
context 'singular module' do
include_context context, 'Weather'
let(:gem_name) do
if context.include?('schema')
'weather-schema'
else
'weather'
end
end
it 'generates a gemspec with schema suffix' do
gemspec = File.join(@plan.destination_root, "#{gem_name}.gemspec")
expect(File.exist?(gemspec)).to be(true)
end
it 'has a gem specification' do
gemspec = File.join(@plan.destination_root, "#{gem_name}.gemspec")
gem = Gem::Specification.load(gemspec)
expect(gem.name).to eq(gem_name)
expect(gem.version).to eq(Gem::Version.new('0.1.0'))
expect(gem.summary).to eq('Generated gem using Smithy')
expect(gem.authors).to eq(['Smithy Ruby'])
expect(gem.files).to include('VERSION', 'CHANGELOG.md')
expect(gem.files).to include("lib/#{gem_name}/types.rb", "lib/#{gem_name}/schema.rb")
expect(gem.license).to eq('Apache-2.0')
dependency = context.include?('schema') ? 'smithy-schema' : 'smithy-client'
expect(gem.dependencies).to include(Gem::Dependency.new(dependency, '1.0.0.pre1'))
expect(gem.required_ruby_version).to eq(Gem::Requirement.new('>= 3.3'))
end
end
context 'nested module' do
include_context context, 'SomeOrganization::Weather', fixture: 'weather'
let(:gem_name) do
if context.include?('schema')
'some_organization-weather-schema'
else
'some_organization-weather'
end
end
it 'generates a gemspec with schema suffix' do
gemspec = File.join(@plan.destination_root, "#{gem_name}.gemspec")
expect(File.exist?(gemspec)).to be(true)
end
it 'has a gem specification' do
gemspec = File.join(@plan.destination_root, "#{gem_name}.gemspec")
gem = Gem::Specification.load(gemspec)
expect(gem.name).to eq(gem_name)
expect(gem.version).to eq(Gem::Version.new('0.1.0'))
expect(gem.summary).to eq('Generated gem using Smithy')
expect(gem.authors).to eq(['Smithy Ruby'])
expect(gem.files).to include('VERSION', 'CHANGELOG.md')
expect(gem.files).to include("lib/#{gem_name}/types.rb", "lib/#{gem_name}/schema.rb")
expect(gem.license).to eq('Apache-2.0')
dependency = context.include?('schema') ? 'smithy-schema' : 'smithy-client'
expect(gem.dependencies).to include(Gem::Dependency.new(dependency, '1.0.0.pre1'))
expect(gem.required_ruby_version).to eq(Gem::Requirement.new('>= 3.3'))
end
end
end