rspec-webservice_matchers 4.1.1 → 4.1.2
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/README.md +8 -1
- data/lib/rspec/webservice_matchers/be_up.rb +1 -2
- data/lib/rspec/webservice_matchers/redirect_helpers.rb +8 -7
- data/lib/rspec/webservice_matchers/version.rb +1 -1
- data/spec/rspec/webservice_matchers/protcol_spec.rb +1 -1
- data/spec/rspec/webservice_matchers/redirect_spec.rb +2 -2
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: faea56877146d051fb37a6e94bff67aad902cbf5
|
4
|
+
data.tar.gz: d62fa5bbc3db07e0a6b7777203d479b2bba9a269
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c294537b29a879e8ef8c8d7826509e970af58112a919d449dc06b50e53caa79cd504411ee190bc3207272fc0736e2ca85e0bfc36a4576ae02c7d7d4430c10cc
|
7
|
+
data.tar.gz: 87a9baebca93b647c705f4db6009c49596024c544243485a4593820f0c741c98d8d52135c07ffe853d5db3d265d8d03e319f680d9f8ddac0160d47693ffcf60f
|
data/README.md
CHANGED
@@ -3,7 +3,13 @@
|
|
3
3
|
[](http://badge.fury.io/rb/rspec-webservice_matchers) [](https://codeclimate.com/github/dogweather/rspec-webservice_matchers)
|
4
4
|
|
5
5
|
|
6
|
-
A [gem](https://rubygems.org/gems/rspec-webservice_matchers) to black-box test a web server configuration. For example, whether a site's SSL certificate is correctly configured and not expired
|
6
|
+
A [gem](https://rubygems.org/gems/rspec-webservice_matchers) to black-box test a web server configuration. For example, whether a site's SSL certificate is correctly configured and not expired:
|
7
|
+
|
8
|
+
```ruby
|
9
|
+
expect('github.com').to have_a_valid_cert
|
10
|
+
```
|
11
|
+
|
12
|
+
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 my motivations.
|
7
13
|
|
8
14
|
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.
|
9
15
|
|
@@ -58,5 +64,6 @@ end
|
|
58
64
|
|
59
65
|
Related Projects
|
60
66
|
----------------
|
67
|
+
* [json-schema-rspec](https://github.com/sharethrough/json-schema-rspec)
|
61
68
|
* [serverspec](http://serverspec.org)
|
62
69
|
* [HTTP Assertions](https://github.com/dogweather/HTTP-Assertions): A precusor to this library. Written in the older test case / assert style.
|
@@ -3,8 +3,7 @@ require 'rspec/webservice_matchers/util'
|
|
3
3
|
module RSpec
|
4
4
|
module WebserviceMatchers
|
5
5
|
module BeUp
|
6
|
-
# Pass when the response code is 200, following redirects
|
7
|
-
# if necessary.
|
6
|
+
# Pass when the response code is 200, following redirects if necessary.
|
8
7
|
RSpec::Matchers.define :be_up do
|
9
8
|
status = nil
|
10
9
|
|
@@ -7,13 +7,14 @@ module RSpec
|
|
7
7
|
return Util.error_message(exception) if exception
|
8
8
|
|
9
9
|
errors = []
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
if redirect? status
|
11
|
+
unless redirect? status, kind: kind
|
12
|
+
errors << "received a #{kind_for(status)} redirect"
|
13
|
+
end
|
14
|
+
unless locations_match? expected, actual_location
|
15
|
+
errors << "received location #{actual_location}"
|
16
|
+
end
|
17
|
+
else
|
17
18
|
errors << "not a redirect: received status #{status}"
|
18
19
|
end
|
19
20
|
|
@@ -51,7 +51,7 @@ describe 'be_up' do
|
|
51
51
|
it 'gives relevant error output' do
|
52
52
|
expect {
|
53
53
|
expect('http://notfound.com/no.txt').to be_up
|
54
|
-
}.to fail_matching(
|
54
|
+
}.to fail_matching(/^received status 404$/i)
|
55
55
|
end
|
56
56
|
|
57
57
|
it 'succeeds even if the site times out on the first try' do
|
@@ -29,7 +29,7 @@ describe 'redirect_permanently_to' do
|
|
29
29
|
it 'gives a good error message for a non-redirect status' do
|
30
30
|
expect {
|
31
31
|
expect('notfound.com').to redirect_permanently_to 'http://the-wrong-site.com/'
|
32
|
-
}.to fail_matching(
|
32
|
+
}.to fail_matching(/^not a redirect: received status 404$/i)
|
33
33
|
end
|
34
34
|
|
35
35
|
it 'gives a good error message when the hostname is bad' do
|
@@ -67,7 +67,7 @@ describe 'redirect_temporarily_to' do
|
|
67
67
|
it 'gives a good error message for a non-redirect status' do
|
68
68
|
expect {
|
69
69
|
expect('notfound.com').to redirect_temporarily_to 'www.nowhere.com'
|
70
|
-
}.to fail_matching(
|
70
|
+
}.to fail_matching(/^not a redirect: received status 404$/i)
|
71
71
|
end
|
72
72
|
|
73
73
|
it 'gives a good error message when the hostname is bad' do
|
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.1.
|
4
|
+
version: 4.1.2
|
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-01-
|
11
|
+
date: 2016-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -171,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
171
171
|
version: '0'
|
172
172
|
requirements: []
|
173
173
|
rubyforge_project:
|
174
|
-
rubygems_version: 2.5.
|
174
|
+
rubygems_version: 2.5.1
|
175
175
|
signing_key:
|
176
176
|
specification_version: 4
|
177
177
|
summary: Black-box web app configuration testing
|
@@ -181,4 +181,3 @@ test_files:
|
|
181
181
|
- spec/rspec/webservice_matchers/redirect_spec.rb
|
182
182
|
- spec/rspec/webservice_matchers/ssl_spec.rb
|
183
183
|
- spec/spec_helper.rb
|
184
|
-
has_rdoc:
|