akamai_rspec 0.2.2 → 0.2.3

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: d7d2bc2a0a9835aa3605d0922cabd0d9785b86ef
4
- data.tar.gz: f18070814a01e2ae62b74b3374237539aa19253d
3
+ metadata.gz: 95accf56ecbd5da4dea5c91a38288a6f216607d0
4
+ data.tar.gz: 3491425883955d90f7a0f8122cdfbbcfba5042d6
5
5
  SHA512:
6
- metadata.gz: dcfe54495c78e35e33cf2169adca882bc2b319fbb1f8198bddd4de6bb4f3040f7b8e82a32692c792befd3bdde78486b4e97c2d3cea848813d989bf1cf5abb5a5
7
- data.tar.gz: 0231dca013b89a93896a2a098cbf48097d0c605893d5716bc44004cbea7d2bd9ac6335d91c086da88c46cf571cf2cdf4ff0fff6191b0b1c366bdb2098ce6e973
6
+ metadata.gz: 2d70621b82a1a6bbb246918c824cfb99f06236ad69c5f2f36e112cd7b46be53ecc99807157b94a449956524f4213321d1657b253fae52707c7b0282036ccc137
7
+ data.tar.gz: 4ef55828e09f523a8bfe1e9eabeba551be6f9d5aefa317e48406819f7c24aeb596b679aa9c48415fdf45bc32a93a2801670d6cf098c89d89e4d29f6362d473e5
@@ -6,20 +6,26 @@ require_relative 'non_akamai'
6
6
  require_relative 'honour_origin_headers'
7
7
  include AkamaiHeaders
8
8
 
9
- RSpec::Matchers.define :x_cache_key_contains do |contents|
9
+ RSpec::Matchers.define :be_served_from_origin do |contents|
10
10
  match do |url|
11
11
  response = RestClient::Request.responsify url
12
12
  fail 'No X-Cache-Key header' if response.headers[:x_cache_key].nil?
13
- unless response.headers[:x_cache_key].include?(contents)
14
- fail("x_cache_key has value '#{response.headers[:x_cache_key]}' which doesn't include '#{contents}'")
13
+ unless response.headers[:x_cache_key] =~ /\/#{contents}\//
14
+ fail("x_cache_key has value '#{response.headers[:x_cache_key]}' which doesn't match '#{contents}'")
15
15
  end
16
- response.code == 200 && response.headers[:x_cache_key].include?(contents)
16
+ response.code == 200
17
17
  end
18
18
  end
19
19
 
20
- module RSpec::Matchers
21
- alias_method :be_served_from_origin, :x_cache_key_contains
22
- alias_method :have_cp_code, :x_cache_key_contains
20
+ RSpec::Matchers.define :have_cp_code do |contents|
21
+ match do |url|
22
+ response = RestClient::Request.responsify url
23
+ fail 'No X-Cache-Key header' if response.headers[:x_cache_key].nil?
24
+ unless response.headers[:x_cache_key].include?(contents)
25
+ fail("x_cache_key has value '#{response.headers[:x_cache_key]}' which doesn't include '#{contents}'")
26
+ end
27
+ response.code == 200
28
+ end
23
29
  end
24
30
 
25
31
  RSpec::Matchers.define :be_forwarded_to_index do |channel|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: akamai_rspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bianca Gibson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-19 00:00:00.000000000 Z
11
+ date: 2015-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -52,7 +52,7 @@ dependencies:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.2'
55
- description:
55
+ description: Test your akamai configuration with rspec
56
56
  email: bianca.gibson@rea-group.com
57
57
  executables: []
58
58
  extensions: []