awspec 1.3.1 → 1.4.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 +4 -4
- data/doc/_resource_types/cloudfront_distribution.md +21 -0
- data/doc/resource_types.md +22 -0
- data/lib/awspec/matcher.rb +1 -0
- data/lib/awspec/matcher/have_custom_response_error_code.rb +21 -0
- data/lib/awspec/stub/cloudfront_distribution.rb +21 -1
- data/lib/awspec/type/cloudfront_distribution.rb +14 -0
- data/lib/awspec/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ceb17a3689dd2f5d09f7f6d81ea45a9c942acf1a
|
4
|
+
data.tar.gz: 5b366ffd176f57432191a0102eefebcb8b52156b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc5c81dc46b5d411610a4916eed9d5c70f9d3806cb0e1b209471358abe3797498a49ef36d8d10289b7b2b0d621705b3aa61f79414db9233787ca981d4761b85a
|
7
|
+
data.tar.gz: df1dc95e8bb583a2e4b8ffe5b57aedd52e255ccb77408a079828f9b209988b53239191f445611526033508a37756a88ff7e64bb92e7d3cb2c760bf66b6cca85c
|
@@ -14,6 +14,27 @@ describe cloudfront_distribution('123456789zyxw.cloudfront.net') do
|
|
14
14
|
end
|
15
15
|
```
|
16
16
|
|
17
|
+
### have_custom_response_error_code
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
it do
|
21
|
+
should have_custom_response_error_code(400)
|
22
|
+
.error_caching_min_ttl(60)
|
23
|
+
.response_page_path('/path/to/400.html')
|
24
|
+
.response_code(400)
|
25
|
+
end
|
26
|
+
it do
|
27
|
+
should have_custom_response_error_code(403)
|
28
|
+
.error_caching_min_ttl(60)
|
29
|
+
.response_page_path('/path/to/403.html')
|
30
|
+
.response_code('403')
|
31
|
+
end
|
32
|
+
it do
|
33
|
+
should have_custom_response_error_code(500)
|
34
|
+
.error_caching_min_ttl(60)
|
35
|
+
end
|
36
|
+
```
|
37
|
+
|
17
38
|
### have_origin
|
18
39
|
|
19
40
|
```ruby
|
data/doc/resource_types.md
CHANGED
@@ -331,6 +331,28 @@ end
|
|
331
331
|
```
|
332
332
|
|
333
333
|
|
334
|
+
### have_custom_response_error_code
|
335
|
+
|
336
|
+
```ruby
|
337
|
+
it do
|
338
|
+
should have_custom_response_error_code(400)
|
339
|
+
.error_caching_min_ttl(60)
|
340
|
+
.response_page_path('/path/to/400.html')
|
341
|
+
.response_code(400)
|
342
|
+
end
|
343
|
+
it do
|
344
|
+
should have_custom_response_error_code(403)
|
345
|
+
.error_caching_min_ttl(60)
|
346
|
+
.response_page_path('/path/to/403.html')
|
347
|
+
.response_code('403')
|
348
|
+
end
|
349
|
+
it do
|
350
|
+
should have_custom_response_error_code(500)
|
351
|
+
.error_caching_min_ttl(60)
|
352
|
+
end
|
353
|
+
```
|
354
|
+
|
355
|
+
|
334
356
|
### have_origin
|
335
357
|
|
336
358
|
```ruby
|
data/lib/awspec/matcher.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
RSpec::Matchers.define :have_custom_response_error_code do |error_code|
|
2
|
+
match do |cloudfront_distribution|
|
3
|
+
cloudfront_distribution.has_custom_response_error_code?(error_code,
|
4
|
+
response_page_path: @response_page_path,
|
5
|
+
response_code: @response_code,
|
6
|
+
error_caching_min_ttl: @error_caching_min_ttl
|
7
|
+
)
|
8
|
+
end
|
9
|
+
|
10
|
+
chain :response_page_path do |response_page_path|
|
11
|
+
@response_page_path = response_page_path
|
12
|
+
end
|
13
|
+
|
14
|
+
chain :response_code do |response_code|
|
15
|
+
@response_code = response_code
|
16
|
+
end
|
17
|
+
|
18
|
+
chain :error_caching_min_ttl do |error_caching_min_ttl|
|
19
|
+
@error_caching_min_ttl = error_caching_min_ttl
|
20
|
+
end
|
21
|
+
end
|
@@ -176,7 +176,27 @@ Aws.config[:cloudfront] = {
|
|
176
176
|
},
|
177
177
|
custom_error_responses: {
|
178
178
|
quantity: 0,
|
179
|
-
items:
|
179
|
+
items:
|
180
|
+
[
|
181
|
+
{
|
182
|
+
error_code: 400,
|
183
|
+
response_page_path: '/path/to/400.html',
|
184
|
+
response_code: '400',
|
185
|
+
error_caching_min_ttl: 60
|
186
|
+
},
|
187
|
+
{
|
188
|
+
error_code: 403,
|
189
|
+
response_page_path: '/path/to/403.html',
|
190
|
+
response_code: '403',
|
191
|
+
error_caching_min_ttl: 60
|
192
|
+
},
|
193
|
+
{
|
194
|
+
error_code: 500,
|
195
|
+
response_page_path: '',
|
196
|
+
response_code: '',
|
197
|
+
error_caching_min_ttl: 60
|
198
|
+
}
|
199
|
+
]
|
180
200
|
},
|
181
201
|
comment: 'cf-s3-origin-hosting.dev.example.com',
|
182
202
|
price_class: 'PriceClass_200',
|
@@ -42,5 +42,19 @@ module Awspec::Type
|
|
42
42
|
origin_path = domain_name_and_path.gsub(%r(\A[^/]*), '')
|
43
43
|
has_origin?(nil, domain_name: domain_name, origin_path: origin_path)
|
44
44
|
end
|
45
|
+
|
46
|
+
def has_custom_response_error_code?(error_code,
|
47
|
+
response_page_path: nil,
|
48
|
+
response_code: nil,
|
49
|
+
error_caching_min_ttl: nil)
|
50
|
+
return false unless [error_code, domain_name].any?
|
51
|
+
resource_via_client.custom_error_responses.items.find do |error|
|
52
|
+
next false if !error_code.nil? && error.error_code != error_code
|
53
|
+
next false if !response_page_path.nil? && error.response_page_path != response_page_path
|
54
|
+
next false if !response_code.nil? && error.response_code != response_code.to_s
|
55
|
+
next false if !error_caching_min_ttl.nil? && error.error_caching_min_ttl != error_caching_min_ttl
|
56
|
+
true
|
57
|
+
end
|
58
|
+
end
|
45
59
|
end
|
46
60
|
end
|
data/lib/awspec/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: awspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- k1LoW
|
@@ -444,6 +444,7 @@ files:
|
|
444
444
|
- lib/awspec/matcher/belong_to_subnet.rb
|
445
445
|
- lib/awspec/matcher/belong_to_vpc.rb
|
446
446
|
- lib/awspec/matcher/have_attribute_definition.rb
|
447
|
+
- lib/awspec/matcher/have_custom_response_error_code.rb
|
447
448
|
- lib/awspec/matcher/have_inline_policy.rb
|
448
449
|
- lib/awspec/matcher/have_key_policy.rb
|
449
450
|
- lib/awspec/matcher/have_key_schema.rb
|