awspec 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ceb17a3689dd2f5d09f7f6d81ea45a9c942acf1a
4
- data.tar.gz: 5b366ffd176f57432191a0102eefebcb8b52156b
3
+ metadata.gz: f970bc538fb04d164d61d967d7ec7cb84b94dbd8
4
+ data.tar.gz: 2eccd8bedcdc720279b729893d5019a83fe54f5c
5
5
  SHA512:
6
- metadata.gz: dc5c81dc46b5d411610a4916eed9d5c70f9d3806cb0e1b209471358abe3797498a49ef36d8d10289b7b2b0d621705b3aa61f79414db9233787ca981d4761b85a
7
- data.tar.gz: df1dc95e8bb583a2e4b8ffe5b57aedd52e255ccb77408a079828f9b209988b53239191f445611526033508a37756a88ff7e64bb92e7d3cb2c760bf66b6cca85c
6
+ metadata.gz: 938f2b1da496f0117fae3c3d465f7db4bed4f95db47e8e204ee897db6718a0950d90ba951b8984de8473f806eb0196c539abb15e02566c26db5c753fcd765ae2
7
+ data.tar.gz: ece3ea3abaf9147db7510371e3cf6531fbdad8acbf06536e32b35190f71d3bf1d212917d2dac54ba24efa25abe37a7f0a406c7f557fea05db85373327a4adcd6
@@ -17,6 +17,7 @@ end
17
17
  ### have_custom_response_error_code
18
18
 
19
19
  ```ruby
20
+ describe cloudfront_distribution('123456789zyxw.cloudfront.net') do
20
21
  it do
21
22
  should have_custom_response_error_code(400)
22
23
  .error_caching_min_ttl(60)
@@ -33,6 +34,7 @@ end
33
34
  should have_custom_response_error_code(500)
34
35
  .error_caching_min_ttl(60)
35
36
  end
37
+ end
36
38
  ```
37
39
 
38
40
  ### have_origin
@@ -47,3 +47,12 @@ describe elb('my-elb') do
47
47
  it { should belong_to_vpc('my-vpc') }
48
48
  end
49
49
  ```
50
+
51
+ ### have_tag
52
+
53
+ ```ruby
54
+ describe elb('my-elb') do
55
+ it { should have_tag('Name').value('my-elb') }
56
+ it { should have_tag('my-tag-key').value('my-tag-value') }
57
+ end
58
+ ```
@@ -334,6 +334,7 @@ end
334
334
  ### have_custom_response_error_code
335
335
 
336
336
  ```ruby
337
+ describe cloudfront_distribution('123456789zyxw.cloudfront.net') do
337
338
  it do
338
339
  should have_custom_response_error_code(400)
339
340
  .error_caching_min_ttl(60)
@@ -350,6 +351,7 @@ end
350
351
  should have_custom_response_error_code(500)
351
352
  .error_caching_min_ttl(60)
352
353
  end
354
+ end
353
355
  ```
354
356
 
355
357
 
@@ -1274,6 +1276,15 @@ end
1274
1276
  ```
1275
1277
 
1276
1278
 
1279
+ ### have_tag
1280
+
1281
+ ```ruby
1282
+ describe elb('my-elb') do
1283
+ it { should have_tag('Name').value('my-elb') }
1284
+ it { should have_tag('my-tag-key').value('my-tag-value') }
1285
+ end
1286
+ ```
1287
+
1277
1288
  ### belong_to_vpc
1278
1289
 
1279
1290
  ```ruby
@@ -1282,6 +1293,7 @@ describe elb('my-elb') do
1282
1293
  end
1283
1294
  ```
1284
1295
 
1296
+
1285
1297
  ### its(:health_check_target), its(:health_check_interval), its(:health_check_timeout), its(:health_check_unhealthy_threshold), its(:health_check_healthy_threshold), its(:load_balancer_name), its(:dns_name), its(:canonical_hosted_zone_name), its(:canonical_hosted_zone_name_id), its(:backend_server_descriptions), its(:availability_zones), its(:subnets), its(:vpc_id), its(:security_groups), its(:created_time), its(:scheme)
1286
1298
  ## <a name="iam_group">iam_group</a>
1287
1299
 
@@ -47,6 +47,9 @@ describe elb('<%= lb.load_balancer_name %>') do
47
47
  <% lb[:listener_descriptions].each do |desc| %>
48
48
  it { should have_listener(protocol: '<%= desc.listener.protocol %>', port: <%= desc.listener.load_balancer_port %>, instance_protocol: '<%= desc.listener.instance_protocol %>', instance_port: <%= desc.listener.instance_port %>) }
49
49
  <% end %>
50
+ <% select_all_elb_tags(lb.load_balancer_name).each do |tag| %>
51
+ it { should have_tag('<%= tag.key %>').value('<%= tag.value %>') }
52
+ <% end %>
50
53
  end
51
54
  EOF
52
55
  template
@@ -16,6 +16,13 @@ module Awspec::Helper
16
16
  lb.vpc_id == vpc_id
17
17
  end
18
18
  end
19
+
20
+ def select_all_elb_tags(id)
21
+ res = elb_client.describe_tags({
22
+ load_balancer_names: [id]
23
+ })
24
+ res.tag_descriptions.single_resource(id).tags
25
+ end
19
26
  end
20
27
  end
21
28
  end
@@ -37,6 +37,23 @@ Aws.config[:elasticloadbalancing] = {
37
37
  vpc_id: 'vpc-ab123cde'
38
38
  }
39
39
  ]
40
+ },
41
+ describe_tags: {
42
+ tag_descriptions: [
43
+ {
44
+ load_balancer_name: 'my-elb',
45
+ tags: [
46
+ {
47
+ key: 'Name',
48
+ value: 'my-elb'
49
+ },
50
+ {
51
+ key: 'my-tag-key',
52
+ value: 'my-tag-value'
53
+ }
54
+ ]
55
+ }
56
+ ]
40
57
  }
41
58
  }
42
59
  }
@@ -57,5 +57,12 @@ module Awspec::Type
57
57
  listener.instance_protocol == instance_protocol && listener.instance_port == instance_port
58
58
  end
59
59
  end
60
+
61
+ def has_tag?(tag_key, tag_value)
62
+ tag_set = select_all_elb_tags(@id)
63
+ tag_set.find do |tag|
64
+ tag.key == tag_key && tag.value == tag_value
65
+ end
66
+ end
60
67
  end
61
68
  end
@@ -1,3 +1,3 @@
1
1
  module Awspec
2
- VERSION = '1.4.0'
2
+ VERSION = '1.4.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - k1LoW
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-02-05 00:00:00.000000000 Z
11
+ date: 2018-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -610,7 +610,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
610
610
  version: '0'
611
611
  requirements: []
612
612
  rubyforge_project:
613
- rubygems_version: 2.6.13
613
+ rubygems_version: 2.5.2
614
614
  signing_key:
615
615
  specification_version: 4
616
616
  summary: RSpec tests for your AWS resources.