rspec-webservice_matchers 1.2.2 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e62fe40def403875ad5bec7d114e96402e7d668c
4
- data.tar.gz: e3e2a83066cec63b84ad9b02fb785c022f81bd48
3
+ metadata.gz: 10271047f0647b3f8bf5aeafbe665214615807f3
4
+ data.tar.gz: 8ad50cfcf15f9b85b528301fe04daf34e0f29b58
5
5
  SHA512:
6
- metadata.gz: 95e971b5f599d637de0a5218c7140d24ad9f3650b9247da72ac22fea33b3516621fb642a91c0f2cf659b38a9102cd0035a6b74504ffa9bd2df9381502652c953
7
- data.tar.gz: a1debd0244fd675b6e989a76ca507f4c5f6b21e96b64418fcf71f6a4711bfb1abea7da61cf9b2f04f030c6ae745cf528553a9b1efa73d32ccbeb9db4be1d8b8e
6
+ metadata.gz: 920c4cf683f0c68f552ad8b4cc3d03eb6ad9253d44c97e094f0e8047b313906bd61b254f5e69730199a01f2e327c50f01ee618a96b39643a112dc89b380b3bf3
7
+ data.tar.gz: 23e9d8e71ed8c1915071cc37e9061ec9627f372917eb06de06fdc149ff60fc72d30ab52cf7910232512a1cab2f7cc9ee6d7f02274becb64fe5c3968af8a57cdb
data/.travis.yml CHANGED
@@ -1,4 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - "1.9.3"
4
- - "2.0.0"
4
+ - "2.0.0"
5
+ - "2.1.0"
@@ -39,17 +39,25 @@ module RSpec
39
39
 
40
40
  # Pass successfully if we get a 301 to the place we intend.
41
41
  RSpec::Matchers.define :redirect_permanently_to do |expected|
42
- match do |url|
43
- response = RSpec::WebserviceMatchers.connection.head(url)
44
- response.status == 301 && response.headers['location'] == expected
42
+ match do |url_or_domain_name|
43
+ response = RSpec::WebserviceMatchers.connection.head(RSpec::WebserviceMatchers.make_url url_or_domain_name)
44
+ expected = RSpec::WebserviceMatchers.make_url(expected)
45
+ actual = response.headers['location']
46
+ status = response.status
47
+
48
+ (status == 301) && (%r|#{expected}/?| === actual)
45
49
  end
46
50
  end
47
51
 
48
52
  # Pass successfully if we get a 302 or 307 to the place we intend.
49
53
  RSpec::Matchers.define :redirect_temporarily_to do |expected|
50
54
  match do |url|
51
- response = RSpec::WebserviceMatchers.connection.head(url)
52
- [302, 307].include?(response.status) && response.headers['location'] == expected
55
+ response = RSpec::WebserviceMatchers.connection.head(RSpec::WebserviceMatchers.make_url(url))
56
+ expected = RSpec::WebserviceMatchers.make_url(expected)
57
+ actual = response.headers['location']
58
+ status = response.status
59
+
60
+ [302, 307].include?(status) && (%r|#{expected}/?| === actual)
53
61
  end
54
62
  end
55
63
 
@@ -1,5 +1,5 @@
1
1
  module RSpec
2
2
  module WebserviceMatchers
3
- VERSION = "1.2.2"
3
+ VERSION = "1.3.0"
4
4
  end
5
5
  end
@@ -10,12 +10,23 @@ describe 'redirect_permanently_to' do
10
10
  expect('http://weblaws.org').to redirect_permanently_to('http://www.weblaws.org/')
11
11
  expect('http://www.getquisitive.com/press-kit/').to redirect_permanently_to 'http://getquisitive.com/press-kit/'
12
12
  end
13
+
14
+ it 'handles domain names gracefully' do
15
+ expect('weblaws.org').to redirect_permanently_to('www.weblaws.org/')
16
+ end
17
+
18
+ it 'handles missing final slash' do
19
+ expect('weblaws.org').to redirect_permanently_to('www.weblaws.org')
20
+ end
13
21
  end
14
22
 
23
+
15
24
  describe 'redirect_temporarily_to' do
16
25
  it 'passes when it gets a 302' do
17
26
  'http://www.oregonlaws.org/cms/about_us'.should redirect_temporarily_to 'http://www.weblaws.org/cms/about_us'
18
27
  end
19
28
 
29
+ # TODO: Set up the mock server and test these
30
+ it 'handles domain names gracefully'
20
31
  it 'passes when it gets a 307'
21
32
  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.2.2
4
+ version: 1.3.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-02-21 00:00:00.000000000 Z
11
+ date: 2014-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler