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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d1aef515c1aac674c133b8684f31f3ada36751fe
4
- data.tar.gz: 02273fdbd1225c5b7976784816c48a6dcfe8c6ab
3
+ metadata.gz: 2b1695496042a67e3abc9091838f8c18a0a5ba55
4
+ data.tar.gz: ee02bda5eb989137c8cfec9f782d2f45344c8b7d
5
5
  SHA512:
6
- metadata.gz: ecc4f32d6450bb6846df978954a9b591c96dd035f66b20119d72e82e90cacec39801e5bd4dc2104aaf261ed4c81c634c1901b155e0e268394146ec641ab2dd64
7
- data.tar.gz: 850444078a34d72744732ad3beff1966fdd7844d03518681f6c5656b9e653be616daef5e02aaf1d6bba5063e58581b0fc0ec1612904f9181b66d9b53e2aa581b
6
+ metadata.gz: 9f8acb1ade62b454163648f8e7d59562d64953f748af61576a0b797d2922d2fc74131481caeb8578ab22cab78bd25da96463bf557c89e6ec2eeee09354ea1cbf
7
+ data.tar.gz: 9d5ad3154d0db6175977d39b4181eb637cacaf1a64f7591b0665d03c75fab8fff043cdf09e10a38b9f6801b332fc7cbc3950590f85133c3aa20411aba10eae5f
data/.travis.yml CHANGED
@@ -1,5 +1,4 @@
1
1
  language: ruby
2
2
  rvm:
3
- - "1.9.3"
4
3
  - "2.0.0"
5
4
  - "2.1.0"
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
- url = RSpec::WebserviceMatchers.make_url(url_or_domain_name)
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
 
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module WebserviceMatchers
3
- VERSION = "1.3.1"
3
+ VERSION = "1.4.0"
4
4
  end
5
5
  end
@@ -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
- 'http://www.rfc-editor.org/rfc/rfc2616.txt'.should be_up
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.3.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-03 00:00:00.000000000 Z
11
+ date: 2014-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler