rspec-webservice_matchers 3.1 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -3
- data/README.md +3 -0
- data/lib/rspec/webservice_matchers.rb +6 -6
- data/lib/rspec/webservice_matchers/version.rb +1 -1
- data/rspec-webservice_matchers.gemspec +2 -2
- data/spec/rspec/webservice_matchers/protcol_spec.rb +10 -10
- data/spec/rspec/webservice_matchers/public_api_spec.rb +4 -4
- data/spec/rspec/webservice_matchers/redirect_spec.rb +3 -3
- data/spec/rspec/webservice_matchers/ssl_spec.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50a2a82e5b5a318363429eba8ab32398d9e3cf38
|
4
|
+
data.tar.gz: a2da7ee77d7d23b2c2658ddf7a305dcde37ca32e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7406558ad74e42e84efcbe2fa7ebcab3766845aecc9cbabe3429bc54e80bc4fa78fe023f84b3a994e6710c673e733c5ac0fd3609d8d06e4fcb7a3a90f52e214c
|
7
|
+
data.tar.gz: 3232473d11a9a323bb70911166040680258c21a82c470e2e6f3906d68c94fa9b221f0726e865230104a8a2458bfd86d3d7ddc0e867cd6ea32342f9cf2bba4495
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -2,10 +2,13 @@
|
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/rspec-webservice_matchers.png)](http://badge.fury.io/rb/rspec-webservice_matchers) [![Build Status](https://travis-ci.org/dogweather/rspec-webservice_matchers.png?branch=master)](https://travis-ci.org/dogweather/rspec-webservice_matchers) [![Code Climate](https://codeclimate.com/github/dogweather/rspec-webservice_matchers.png)](https://codeclimate.com/github/dogweather/rspec-webservice_matchers)
|
4
4
|
|
5
|
+
[Issues and todo's are now managed Assembly as Bounties](https://assembly.com/think-200/bounties).
|
6
|
+
|
5
7
|
This [gem](https://rubygems.org/gems/rspec-webservice_matchers) enables you to black-box test a web app's server configuration. For example, whether its SSL certificate is correctly configured and not expired. It's a tool for doing **Test Driven Devops** (I just made that up). See [the introductory blog post](http://robb.weblaws.org/2014/01/16/new-open-source-library-for-test-driven-devops/) for more about the motivations for making this.
|
6
8
|
|
7
9
|
This library takes a minimalist approach: it simply adds new RSpec matchers. Therefore, you can use your own RSpec writing style; there's no new DSL to learn.
|
8
10
|
|
11
|
+
|
9
12
|
Installation
|
10
13
|
------------
|
11
14
|
```Shell
|
@@ -26,7 +26,7 @@ module RSpec
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
|
29
|
+
failure_message do
|
30
30
|
error_message
|
31
31
|
end
|
32
32
|
end
|
@@ -49,7 +49,7 @@ module RSpec
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
|
52
|
+
failure_message do
|
53
53
|
if !error_message.nil?
|
54
54
|
error_message
|
55
55
|
else
|
@@ -87,7 +87,7 @@ module RSpec
|
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
|
-
|
90
|
+
failure_message do
|
91
91
|
if !error_message.nil?
|
92
92
|
error_message
|
93
93
|
else
|
@@ -132,7 +132,7 @@ module RSpec
|
|
132
132
|
|
133
133
|
# Create a compound error message listing all of the
|
134
134
|
# relevant actual values received.
|
135
|
-
|
135
|
+
failure_message do
|
136
136
|
if !error_msg.nil?
|
137
137
|
error_msg
|
138
138
|
else
|
@@ -165,7 +165,7 @@ module RSpec
|
|
165
165
|
actual_code == expected_code
|
166
166
|
end
|
167
167
|
|
168
|
-
|
168
|
+
failure_message do
|
169
169
|
"Received status #{actual_code}"
|
170
170
|
end
|
171
171
|
end
|
@@ -183,7 +183,7 @@ module RSpec
|
|
183
183
|
actual_status == 200
|
184
184
|
end
|
185
185
|
|
186
|
-
|
186
|
+
failure_message do
|
187
187
|
"Received status #{actual_status}"
|
188
188
|
end
|
189
189
|
end
|
@@ -21,9 +21,9 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency 'bundler', '~> 1.3'
|
22
22
|
spec.add_development_dependency 'rake'
|
23
23
|
spec.add_development_dependency 'pry'
|
24
|
-
spec.add_development_dependency 'webmock'
|
24
|
+
spec.add_development_dependency 'webmock', '>= 1.20.4'
|
25
25
|
|
26
|
-
spec.add_runtime_dependency 'rspec', '~>
|
26
|
+
spec.add_runtime_dependency 'rspec', '~> 3.0'
|
27
27
|
spec.add_runtime_dependency 'excon'
|
28
28
|
spec.add_runtime_dependency 'faraday'
|
29
29
|
spec.add_runtime_dependency 'faraday_middleware'
|
@@ -3,19 +3,19 @@ require 'rspec/webservice_matchers'
|
|
3
3
|
|
4
4
|
describe 'be_status' do
|
5
5
|
it 'can check 200 for successful resource requests' do
|
6
|
-
'http://a-page.com/a/page.txt'.
|
6
|
+
expect('http://a-page.com/a/page.txt').to be_status 200
|
7
7
|
end
|
8
8
|
|
9
9
|
it 'handles domain names as well as URLs' do
|
10
|
-
'www.website.com'.
|
10
|
+
expect('www.website.com').to be_status 200
|
11
11
|
end
|
12
12
|
|
13
13
|
it 'accepts status code in text form too' do
|
14
|
-
'www.website.com'.
|
14
|
+
expect('www.website.com').to be_status '200'
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'can check for the 503 - Service Unavailable status' do
|
18
|
-
'http://outoforder.com/'.
|
18
|
+
expect('http://outoforder.com/').to be_status 503
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'can check for 404' do
|
@@ -29,22 +29,22 @@ describe 'be_status' do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'succeeds even if the site times out on the first try' do
|
32
|
-
'http://www.timeout-once.com'.
|
32
|
+
expect('http://www.timeout-once.com').to be_status 200
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
describe 'be_up' do
|
37
37
|
it 'follows redirects when necessary' do
|
38
|
-
'perm-redirector.com'.
|
39
|
-
'temp-redirector.org'.
|
38
|
+
expect('perm-redirector.com').to be_up
|
39
|
+
expect('temp-redirector.org').to be_up
|
40
40
|
end
|
41
41
|
|
42
42
|
it 'can also handle a simple 200' do
|
43
|
-
'http://www.website.com/'.
|
43
|
+
expect('http://www.website.com/').to be_up
|
44
44
|
end
|
45
45
|
|
46
46
|
it 'is available via a public API' do
|
47
|
-
RSpec::WebserviceMatchers.up?('http://www.website.com/').
|
47
|
+
expect(RSpec::WebserviceMatchers.up?('http://www.website.com/')).to be true
|
48
48
|
end
|
49
49
|
|
50
50
|
it 'gives relevant error output' do
|
@@ -54,6 +54,6 @@ describe 'be_up' do
|
|
54
54
|
end
|
55
55
|
|
56
56
|
it 'succeeds even if the site times out on the first try' do
|
57
|
-
'http://www.timeout-once.com'.
|
57
|
+
expect('http://www.timeout-once.com').to be_up
|
58
58
|
end
|
59
59
|
end
|
@@ -3,11 +3,11 @@ require 'rspec/webservice_matchers'
|
|
3
3
|
|
4
4
|
describe '#up?' do
|
5
5
|
it 'follows redirects when necessary' do
|
6
|
-
RSpec::WebserviceMatchers.up?('perm-redirector.com').
|
7
|
-
RSpec::WebserviceMatchers.up?('temp-redirector.org').
|
6
|
+
expect(RSpec::WebserviceMatchers.up?('perm-redirector.com')).to be_truthy
|
7
|
+
expect(RSpec::WebserviceMatchers.up?('temp-redirector.org')).to be_truthy
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'retries timeout errors once' do
|
11
|
-
RSpec::WebserviceMatchers.up?('http://www.timeout-once.com').
|
11
|
+
expect(RSpec::WebserviceMatchers.up?('http://www.timeout-once.com')).to be_truthy
|
12
12
|
end
|
13
|
-
end
|
13
|
+
end
|
@@ -41,15 +41,15 @@ end
|
|
41
41
|
|
42
42
|
describe 'redirect_temporarily_to' do
|
43
43
|
it 'passes when it gets a 302' do
|
44
|
-
'http://temp-redirector.org'.
|
44
|
+
expect('http://temp-redirector.org').to redirect_temporarily_to 'http://a-page.com/a/page.txt'
|
45
45
|
end
|
46
46
|
|
47
47
|
it 'handles domain names gracefully' do
|
48
|
-
'temp-redirector.org'.
|
48
|
+
expect('temp-redirector.org').to redirect_temporarily_to 'a-page.com/a/page.txt'
|
49
49
|
end
|
50
50
|
|
51
51
|
it 'passes when it gets a 307' do
|
52
|
-
'temp-307-redirector.net'.
|
52
|
+
expect('temp-307-redirector.net').to redirect_temporarily_to 'a-page.com/a/page.txt'
|
53
53
|
end
|
54
54
|
|
55
55
|
it 'gives a good error message for the wrong redirect type' do
|
@@ -28,7 +28,7 @@ describe 'have_a_valid_cert matcher' do
|
|
28
28
|
|
29
29
|
it 'provides a good error message if the request times out' do
|
30
30
|
expect {
|
31
|
-
'www.myapp.com'.
|
31
|
+
expect('www.myapp.com').to have_a_valid_cert
|
32
32
|
}.to fail_matching(/(timeout)|(execution expired)/)
|
33
33
|
end
|
34
34
|
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:
|
4
|
+
version: 4.0.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:
|
11
|
+
date: 2015-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -58,28 +58,28 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 1.20.4
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 1.20.4
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '3.0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '3.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: excon
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -163,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
163
|
version: '0'
|
164
164
|
requirements: []
|
165
165
|
rubyforge_project:
|
166
|
-
rubygems_version: 2.
|
166
|
+
rubygems_version: 2.4.5
|
167
167
|
signing_key:
|
168
168
|
specification_version: 4
|
169
169
|
summary: Black-box web app configuration testing
|