awspec 0.24.2 → 0.25.0

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: 39292abd8aa1e62f4e4b5fa387790bb195ecbbcd
4
- data.tar.gz: 93aaf5af8a1db102d1bd4de00a4223f16e4fef52
3
+ metadata.gz: 472d90ec7243306cf0a11dcfc866f210b9ab4ccb
4
+ data.tar.gz: ba50293921099df6bbecf5e9ac66b9197a06e843
5
5
  SHA512:
6
- metadata.gz: 695b9f482584822502cc969f791f6d406394778458f968900382883015791196ddd8db20b73811e68e534aff8d5403aaa88e8e0a608f44b668561f1548ee29a5
7
- data.tar.gz: 3df34ad6f03d73a862fa3f2cf8e142d6df1a17f799b8ab076d42a186dc02dab690a788be761fdfca2cd9c524a4e4e539366ef2662eda9674355bdb63737479b2
6
+ metadata.gz: fcaac8693210fbdffb22bcccccda20df142c5571999cfba43692e8f7c0b8450b2d39cc86175cb7725cd0a295ac383f862701e5cd4350e98e8b23f1637b34bd0a
7
+ data.tar.gz: b2291fabe762bbd9a390d25e1f03a4a4534afb9eac47020a9b3678aca2029f5c85ef3bb7ba8508545e73a4890cf4bfe79ac24e1c535558aa0e65611c2d794580
data/README.md CHANGED
@@ -1,9 +1,11 @@
1
1
  # awspec [![Gem](https://img.shields.io/gem/v/awspec.svg)](https://rubygems.org/gems/awspec) [![Travis](https://img.shields.io/travis/k1LoW/awspec.svg)](https://travis-ci.org/k1LoW/awspec) [![Scrutinizer](https://img.shields.io/scrutinizer/g/k1LoW/awspec.svg)](https://scrutinizer-ci.com/g/k1LoW/awspec/) [![Gemnasium](https://img.shields.io/gemnasium/k1LoW/awspec.svg)](https://gemnasium.com/k1LoW/awspec)
2
2
 
3
- [![Join the chat at https://gitter.im/k1LoW/awspec](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/k1LoW/awspec?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
3
+ ![Logo](./awspec-logo.png)
4
4
 
5
5
  RSpec tests for your AWS resources.
6
6
 
7
+ [![Join the chat at https://gitter.im/k1LoW/awspec](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/k1LoW/awspec?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
8
+
7
9
  [Resource Types](doc/resource_types.md) | [Contributing](doc/contributing.md)
8
10
 
9
11
  ## Installation
@@ -51,6 +53,8 @@ EOF
51
53
  ### 3. Write spec/*_spec.rb
52
54
 
53
55
  ```ruby
56
+ require 'spec_helper'
57
+
54
58
  describe ec2('my-ec2-tag-name') do
55
59
  it { should be_running }
56
60
  its(:instance_id) { should eq 'i-ec12345a' }
Binary file
@@ -18,6 +18,50 @@ describe s3_bucket('my-bucket') do
18
18
  end
19
19
  ```
20
20
 
21
+ ### have_cors_rule
22
+
23
+ ```ruby
24
+ describe s3_bucket('my-bucket') do
25
+ it do
26
+ should have_cors_rule(
27
+ allowed_methods: ['GET'],
28
+ allowed_origins: ['*']
29
+ )
30
+ end
31
+ it do
32
+ should have_cors_rule(
33
+ allowed_headers: ['*'],
34
+ allowed_methods: ['GET'],
35
+ allowed_origins: ['https://example.org', 'https://example.com'],
36
+ expose_headers: ['X-Custom-Header'],
37
+ max_age_seconds: 3600
38
+ )
39
+ end
40
+ end
41
+ ```
42
+
43
+ ### have_policy
44
+
45
+ ```ruby
46
+ describe s3_bucket('my-bucket') do
47
+ should have_policy <<-POLICY
48
+ {
49
+ "Version": "2012-10-17",
50
+ "Statement": [
51
+ {
52
+ "Sid": "AllowPublicRead",
53
+ "Effect": "Allow",
54
+ "Principal": "*",
55
+ "Action": "s3:GetObject",
56
+ "Resource": "arn:aws:s3:::my-bucket/*"
57
+ }
58
+ ]
59
+ }
60
+ POLICY
61
+ end
62
+ end
63
+ ```
64
+
21
65
  ### have_object
22
66
 
23
67
  ```ruby
@@ -298,6 +298,27 @@ end
298
298
 
299
299
  ### have_cors_rule
300
300
 
301
+ ```ruby
302
+ describe s3_bucket('my-bucket') do
303
+ it do
304
+ should have_cors_rule(
305
+ allowed_methods: ['GET'],
306
+ allowed_origins: ['*']
307
+ )
308
+ end
309
+ it do
310
+ should have_cors_rule(
311
+ allowed_headers: ['*'],
312
+ allowed_methods: ['GET'],
313
+ allowed_origins: ['https://example.org', 'https://example.com'],
314
+ expose_headers: ['X-Custom-Header'],
315
+ max_age_seconds: 3600
316
+ )
317
+ end
318
+ end
319
+ ```
320
+
321
+
301
322
  ### have_object
302
323
 
303
324
  ```ruby
@@ -308,6 +329,27 @@ end
308
329
 
309
330
  ### have_policy
310
331
 
332
+ ```ruby
333
+ describe s3_bucket('my-bucket') do
334
+ should have_policy <<-POLICY
335
+ {
336
+ "Version": "2012-10-17",
337
+ "Statement": [
338
+ {
339
+ "Sid": "AllowPublicRead",
340
+ "Effect": "Allow",
341
+ "Principal": "*",
342
+ "Action": "s3:GetObject",
343
+ "Resource": "arn:aws:s3:::my-bucket/*"
344
+ }
345
+ ]
346
+ }
347
+ POLICY
348
+ end
349
+ end
350
+ ```
351
+
352
+
311
353
  #### its(:acl_grants_count), its(:acl_owner), its(:cors_rules_count), its(:name), its(:creation_date)
312
354
  ## <a name="route53_hosted_zone">route53_hosted_zone</a>
313
355
 
@@ -15,12 +15,15 @@ module Awspec::Helper
15
15
  # secrets.yml
16
16
  creds = YAML.load_file('spec/secrets.yml') if File.exist?('spec/secrets.yml')
17
17
  creds = YAML.load_file('secrets.yml') if File.exist?('secrets.yml')
18
+ return if creds.nil?
19
+ Aws.config.update({
20
+ region: creds['region']
21
+ }) if creds.include?('region')
18
22
  Aws.config.update({
19
- region: creds['region'],
20
23
  credentials: Aws::Credentials.new(
21
24
  creds['aws_access_key_id'],
22
25
  creds['aws_secret_access_key'])
23
- }) if creds
26
+ }) if creds.include?('aws_access_key_id') && creds.include?('aws_secret_access_key')
24
27
  end
25
28
  end
26
29
  end
@@ -1,3 +1,3 @@
1
1
  module Awspec
2
- VERSION = '0.24.2'
2
+ VERSION = '0.25.0'
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: 0.24.2
4
+ version: 0.25.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - k1LoW
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-03 00:00:00.000000000 Z
11
+ date: 2015-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -181,6 +181,7 @@ files:
181
181
  - LICENSE.txt
182
182
  - README.md
183
183
  - Rakefile
184
+ - awspec-logo.png
184
185
  - awspec.gemspec
185
186
  - bin/awspec
186
187
  - doc/_resource_types/autoscaling_group.md