rspec-webservice_matchers 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -10
- data/lib/rspec/webservice_matchers/version.rb +1 -1
- data/lib/rspec/webservice_matchers.rb +8 -0
- data/spec/rspec/webservice_matchers/protcol_spec.rb +11 -0
- 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: b9f1f32a80f4f1fd30f9e7ae4d6242cf4243535f
|
4
|
+
data.tar.gz: bf308f90fd8b6f110a4678f0f5bc45a9cb6114bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0498468205c9dd6e29278c6364c5e9ae240b1e40b18e2507260fb9a1cc332936bfe5db7a3a537bc992cc9d533a905c0da36e81c7fc088e64c5b04b645b8eeeca
|
7
|
+
data.tar.gz: 2d02fae806afedd97717468d530cdd0861b3f92cf81aa682a07d4dd368a18223bd0dd53b83da4656293556489d8a3d077caf6dc24c82cdddc79ab07d54cc42d2
|
data/README.md
CHANGED
@@ -15,15 +15,14 @@ What You Get
|
|
15
15
|
------------
|
16
16
|
These new RSpec matchers:
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
Allows 302 or 307
|
18
|
+
| Notes
|
19
|
+
-------------------------------|------------------------------------------------
|
20
|
+
**be_status** |
|
21
|
+
**be_up** | Follows redirects if necessary and checks for 200
|
22
|
+
**have_a_valid_cert** | Uses [lib-curl](http://curl.haxx.se/libcurl/) via [Curb](https://github.com/taf2/curb) to test validity
|
23
|
+
**enforce_https_everywhere** | See the [EFF project](https://www.eff.org/https-everywhere)
|
24
|
+
**redirect_permanently_to** | Allows 301
|
25
|
+
**redirect_temporarily_to** | Allows 302 or 307
|
27
26
|
|
28
27
|
|
29
28
|
Example
|
@@ -34,10 +33,14 @@ require 'rspec/webservice_matchers'
|
|
34
33
|
|
35
34
|
describe 'My app' do
|
36
35
|
context 'www.myapp.com' do
|
37
|
-
it { should
|
36
|
+
it { should be_up }
|
38
37
|
it { should have_a_valid_cert }
|
39
38
|
end
|
40
39
|
|
40
|
+
it 'serves the about page without redirects' do
|
41
|
+
expect('http://www.myapp.com/about').to be_status 200
|
42
|
+
end
|
43
|
+
|
41
44
|
it 'redirects to www' do
|
42
45
|
expect('http://myapp.com').to redirect_permanently_to 'http://www.myapp.com/'
|
43
46
|
end
|
@@ -72,6 +72,14 @@ module RSpec
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
+
RSpec::Matchers.define :be_up do
|
76
|
+
match do |url_or_domain_name|
|
77
|
+
url = RSpec::WebserviceMatchers.make_url(url_or_domain_name)
|
78
|
+
result = Curl::Easy.http_head(url) { |curl| curl.follow_location = true }
|
79
|
+
(result.response_code == 200)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
75
83
|
|
76
84
|
private
|
77
85
|
|
@@ -16,3 +16,14 @@ describe 'status_code' do
|
|
16
16
|
'http://www.weblaws.org/texas/laws/tex._spec._dist._local_laws_code_section_1011.202_tax_to_pay_general_obligation_bonds'.should be_status 503
|
17
17
|
end
|
18
18
|
end
|
19
|
+
|
20
|
+
|
21
|
+
describe 'be_up' do
|
22
|
+
it 'follows redirects when necessary' do
|
23
|
+
'weblaws.org'.should be_up
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'can also handle a simple 200' do
|
27
|
+
'http://www.rfc-editor.org/rfc/rfc2616.txt'.should be_up
|
28
|
+
end
|
29
|
+
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.1.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-01-
|
11
|
+
date: 2014-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|