rspec-webservice_matchers 1.0.0 → 1.1.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: 48f108c7a2f1464a81fe94c53ceb24896a7f1283
4
- data.tar.gz: 82582ce19e0c6dc81f43ff6fda48bc1460122d89
3
+ metadata.gz: b9f1f32a80f4f1fd30f9e7ae4d6242cf4243535f
4
+ data.tar.gz: bf308f90fd8b6f110a4678f0f5bc45a9cb6114bf
5
5
  SHA512:
6
- metadata.gz: ff3f75d6649f9bf135f354ea5d6e4c37fbd47587c42d119e3a5f0e6339c03307157d33d029fa8eb91bc8bcb3fa742b82fa9c553520ae19d0ae7844fe3d56706b
7
- data.tar.gz: 081c289463249f98ec1ba04d1f44fa2eae0f68e262b3cf19e982953c3a5dc2dc818353922272c4e553bfcc4950372baee820a28ac4b693e718c177fadb0b9bd2
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
- * `be_status`
19
- * `have_a_valid_cert`
20
- Uses lib-curl to test validity
21
- * `enforce_https_everywhere`
22
- See [EFF](https://www.eff.org/https-everywhere)
23
- * `redirect_permanently_to`
24
- Allows 301
25
- * `redirect_temporarily_to`
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 be_status 200 }
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
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module WebserviceMatchers
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  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.0.0
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-18 00:00:00.000000000 Z
11
+ date: 2014-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler