rspec-webservice_matchers 4.3.2 → 4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b5f5a08e75c380122766cc7b59ea390f500e0972
4
- data.tar.gz: c0625f0bcaa039b9002bb8a99c1f4f26277abb44
3
+ metadata.gz: ee9d419168472b84a17978fc376376e13600044b
4
+ data.tar.gz: 61a7113a72c21a523f587b9487996950828d013e
5
5
  SHA512:
6
- metadata.gz: ba6915afda6b9712f07250b75af9252505bddc7bd67339bcab1a94810056119ce033007d13ad90e10cc4229f83c75983aca0c61fea185153be95a49dc9df5cd6
7
- data.tar.gz: 7a09aa0b0fdfb51b2f1f9fe19c9f450ae3f27deaa8a41f0f4c6a66dd0031cdf2f2686c432a4a69407a670c28714091cf9144e506c8c117401a94ebf934b4331b
6
+ metadata.gz: 4900e04fd9fc88d58818f1bd930ae45ea600e99d42eefcc939580fb9811497ef836e7f0d2905541136eba7ce306e11e019e54396a9ccbf4322a75f57acad4540
7
+ data.tar.gz: 53ad30e45cf47bafb019af536e94cd2ac416f2352606b581748de8eb3a7a5b6d3c4f5b899a0c0bcf6d10e84511c8b54a6b98ca662edcfdcac08856bfde7c005f
data/HISTORY.md ADDED
@@ -0,0 +1,5 @@
1
+ 4.4.0
2
+ -----
3
+
4
+ Support for hosts which don't allow the `HEAD` method. This seems to be the case
5
+ with some Google App Engine apps.
@@ -18,12 +18,22 @@ module RSpec
18
18
  end
19
19
 
20
20
  def self.status(url_or_domain_name, follow: false)
21
- head(url_or_domain_name, follow: follow)[0]
21
+ code = head(url_or_domain_name, follow: follow)[0]
22
+ return code if code != 405
23
+ get(url_or_domain_name, follow: follow)[0]
22
24
  end
23
25
 
24
26
  def self.head(url_or_domain_name, follow: false)
27
+ request(:head, url_or_domain_name, follow: follow)
28
+ end
29
+
30
+ def self.get(url_or_domain_name, follow: false)
31
+ request(:get, url_or_domain_name, follow: follow)
32
+ end
33
+
34
+ def self.request(method, url_or_domain_name, follow: false)
25
35
  url = make_url(url_or_domain_name)
26
- response = recheck_on_timeout { connection(follow: follow).head(url) }
36
+ response = recheck_on_timeout { connection(follow: follow).send(method, url) }
27
37
  [response.status, response.headers]
28
38
  end
29
39
 
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module WebserviceMatchers
3
- VERSION = '4.3.2'
3
+ VERSION = '4.4.0'
4
4
  end
5
5
  end
@@ -32,6 +32,10 @@ describe 'be_status' do
32
32
  it 'succeeds even if the site times out on the first try' do
33
33
  expect('http://www.timeout-once.com').to be_status 200
34
34
  end
35
+
36
+ it 'works on hosts which do not support HEAD' do
37
+ expect('http://appengine.com').to be_status 200
38
+ end
35
39
  end
36
40
 
37
41
  describe 'be_up' do
data/spec/spec_helper.rb CHANGED
@@ -7,6 +7,10 @@ RSpec.configure do |config|
7
7
  WebMock.stub_request(:any, /notfound.com/).to_return(status: 404)
8
8
  WebMock.stub_request(:any, 'outoforder.com').to_return(status: 503)
9
9
 
10
+ # A host which doesn't support HEAD
11
+ WebMock.stub_request(:head, 'appengine.com').to_return(status: 405)
12
+ WebMock.stub_request(:get, 'appengine.com').to_return(status: 200)
13
+
10
14
  WebMock.stub_request(:any, 'perm-redirector.com')
11
15
  .to_return(status: 301, headers: { Location: 'http://www.website.com/' })
12
16
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rspec-webservice_matchers
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.2
4
+ version: 4.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robb Shecter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-26 00:00:00.000000000 Z
11
+ date: 2016-02-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -132,6 +132,7 @@ files:
132
132
  - ".gitignore"
133
133
  - ".travis.yml"
134
134
  - Gemfile
135
+ - HISTORY.md
135
136
  - LICENSE.txt
136
137
  - README.md
137
138
  - Rakefile