rspec-webservice_matchers 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/.travis.yml +0 -1
- data/README.md +1 -8
- data/lib/rspec/webservice_matchers.rb +10 -4
- data/lib/rspec/webservice_matchers/version.rb +1 -1
- data/spec/rspec/webservice_matchers/protcol_spec.rb +7 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b1695496042a67e3abc9091838f8c18a0a5ba55
|
4
|
+
data.tar.gz: ee02bda5eb989137c8cfec9f782d2f45344c8b7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f8acb1ade62b454163648f8e7d59562d64953f748af61576a0b797d2922d2fc74131481caeb8578ab22cab78bd25da96463bf557c89e6ec2eeee09354ea1cbf
|
7
|
+
data.tar.gz: 9d5ad3154d0db6175977d39b4181eb637cacaf1a64f7591b0665d03c75fab8fff043cdf09e10a38b9f6801b332fc7cbc3950590f85133c3aa20411aba10eae5f
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -55,16 +55,9 @@ describe 'My app' do
|
|
55
55
|
end
|
56
56
|
```
|
57
57
|
|
58
|
-
|
59
|
-
TODO
|
60
|
-
----
|
61
|
-
* Matchers for more high-level cases
|
62
|
-
* Matchers for JSON schema
|
63
|
-
* More matchers refactored from [weblaws.org](http://www.weblaws.org/) code
|
64
|
-
|
65
58
|
Related Projects
|
66
59
|
----------------
|
67
60
|
* [serverspec](http://serverspec.org)
|
68
|
-
* [HTTP Assertions](https://github.com/dogweather/HTTP-Assertions)
|
61
|
+
* [HTTP Assertions](https://github.com/dogweather/HTTP-Assertions): A precusor to this library. Written in the older test case / assert style.
|
69
62
|
|
70
63
|
|
@@ -26,6 +26,15 @@ module RSpec
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
+
# Return true if the given page has status 200,
|
30
|
+
# and follow a few redirects if necessary.
|
31
|
+
def self.up?(url_or_domain_name)
|
32
|
+
url = RSpec::WebserviceMatchers.make_url(url_or_domain_name)
|
33
|
+
conn = RSpec::WebserviceMatchers.connection(follow: true)
|
34
|
+
response = conn.head(url)
|
35
|
+
response.status == 200
|
36
|
+
end
|
37
|
+
|
29
38
|
|
30
39
|
# RSpec Custom Matchers ###########################################
|
31
40
|
# See https://www.relishapp.com/rspec/rspec-expectations/v/2-3/docs/custom-matchers/define-matcher
|
@@ -87,10 +96,7 @@ module RSpec
|
|
87
96
|
# if necessary.
|
88
97
|
RSpec::Matchers.define :be_up do
|
89
98
|
match do |url_or_domain_name|
|
90
|
-
|
91
|
-
conn = RSpec::WebserviceMatchers.connection(follow: true)
|
92
|
-
response = conn.head(url)
|
93
|
-
response.status == 200
|
99
|
+
RSpec::WebserviceMatchers.up?(url_or_domain_name)
|
94
100
|
end
|
95
101
|
end
|
96
102
|
|
@@ -32,11 +32,17 @@ end
|
|
32
32
|
|
33
33
|
|
34
34
|
describe 'be_up' do
|
35
|
+
let(:rfc_url) {'http://www.rfc-editor.org/rfc/rfc2616.txt'}
|
36
|
+
|
35
37
|
it 'follows redirects when necessary' do
|
36
38
|
'weblaws.org'.should be_up
|
37
39
|
end
|
38
40
|
|
39
41
|
it 'can also handle a simple 200' do
|
40
|
-
|
42
|
+
rfc_url.should be_up
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'is available via a public API' do
|
46
|
+
RSpec::WebserviceMatchers.up?(rfc_url).should be true
|
41
47
|
end
|
42
48
|
end
|
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: 1.
|
4
|
+
version: 1.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: 2014-03-
|
11
|
+
date: 2014-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|