kumogata 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,7 +23,7 @@ end
23
23
  run_client(:validate, :template => template) do |client, cf|
24
24
  json = eval_template(template, :add_encryption_password_for_validation => true).to_json
25
25
 
26
- cf.should_receive(:validate_template).with(json) {
26
+ expect(cf).to receive(:validate_template).with(json) {
27
27
  {}
28
28
  }
29
29
  end
@@ -54,7 +54,7 @@ end
54
54
  run_client(:validate, :template => template) do |client, cf|
55
55
  json = eval_template(template, :add_encryption_password_for_validation => true).to_json
56
56
 
57
- cf.should_receive(:validate_template).with(json) {
57
+ expect(cf).to receive(:validate_template).with(json) {
58
58
  {
59
59
  :code => 'CODE',
60
60
  :message => 'MESSAGE'
@@ -92,7 +92,7 @@ end
92
92
  add_encryption_password_for_validation(template)
93
93
  json = template.to_json
94
94
 
95
- cf.should_receive(:validate_template) {
95
+ expect(cf).to receive(:validate_template) {
96
96
  {}
97
97
  }
98
98
  end
@@ -127,7 +127,7 @@ end
127
127
  add_encryption_password_for_validation(template)
128
128
  json = template.to_json
129
129
 
130
- cf.should_receive(:validate_template).with(json) {
130
+ expect(cf).to receive(:validate_template).with(json) {
131
131
  {
132
132
  :code => 'CODE',
133
133
  :message => 'MESSAGE'
@@ -136,4 +136,55 @@ end
136
136
  end
137
137
  }.to raise_error('CODE: MESSAGE')
138
138
  end
139
+
140
+ it 'validate Ruby template (without verbose option)' do
141
+ template = <<-EOS
142
+ Resources do
143
+ myEC2Instance do
144
+ Type "AWS::EC2::Instance"
145
+ Properties do
146
+ ImageId "ami-XXXXXXXX"
147
+ InstanceType "t1.micro"
148
+ end
149
+ end
150
+ end
151
+
152
+ Outputs do
153
+ AZ do
154
+ Value do
155
+ Fn__GetAtt "myEC2Instance", "AvailabilityZone"
156
+ end
157
+ end
158
+ end
159
+ EOS
160
+
161
+ result = {"parameters"=>
162
+ [{"no_echo"=>false,
163
+ "parameter_key"=>"SSHLocation",
164
+ "description"=>
165
+ "The IP address range that can be used to SSH to the EC2 instances",
166
+ "default_value"=>"0.0.0.0/0"},
167
+ {"no_echo"=>false,
168
+ "parameter_key"=>"XXXXXXXXXXXXXXXX",
169
+ "default_value"=>"(XXXXXXXXXXXXXXXX)"},
170
+ {"no_echo"=>false,
171
+ "parameter_key"=>"InstanceType",
172
+ "description"=>"WebServer EC2 instance type",
173
+ "default_value"=>"m1.small"},
174
+ {"no_echo"=>false,
175
+ "parameter_key"=>"KeyName",
176
+ "description"=>
177
+ "Name of an existing EC2 KeyPair to enable SSH access to the instance"}],
178
+ "capabilities"=>[],
179
+ "description"=>"'test CloudFormation Template\n",
180
+ "response_metadata"=>{"request_id"=>"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"}}
181
+
182
+ expect(Kumogata.logger).to receive(:info).with('Template validated successfully')
183
+ expect(Kumogata.logger).to receive(:info).with(JSON.pretty_generate(result))
184
+
185
+ run_client(:validate, :template => template, :options => {:verbose => true}) do |client, cf|
186
+ json = eval_template(template, :add_encryption_password_for_validation => true).to_json
187
+ expect(cf).to receive(:validate_template).with(json) { result }
188
+ end
189
+ end
139
190
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kumogata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Genki Sugawara
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-14 00:00:00.000000000 Z
11
+ date: 2015-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk