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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee9d419168472b84a17978fc376376e13600044b
|
4
|
+
data.tar.gz: 61a7113a72c21a523f587b9487996950828d013e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4900e04fd9fc88d58818f1bd930ae45ea600e99d42eefcc939580fb9811497ef836e7f0d2905541136eba7ce306e11e019e54396a9ccbf4322a75f57acad4540
|
7
|
+
data.tar.gz: 53ad30e45cf47bafb019af536e94cd2ac416f2352606b581748de8eb3a7a5b6d3c4f5b899a0c0bcf6d10e84511c8b54a6b98ca662edcfdcac08856bfde7c005f
|
data/HISTORY.md
ADDED
@@ -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).
|
36
|
+
response = recheck_on_timeout { connection(follow: follow).send(method, url) }
|
27
37
|
[response.status, response.headers]
|
28
38
|
end
|
29
39
|
|
@@ -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.
|
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-
|
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
|