addressable 2.3.6 → 2.3.7

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of addressable might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c062f20a75939191f680842716b9ce79816e8952
4
- data.tar.gz: 4ff3027264ee6f61fe887f1035c4fa7c472f7c90
3
+ metadata.gz: 531a87b0fdf38663665568cd7e14775397618665
4
+ data.tar.gz: 88cc34caa61da92564835b0cf34a6e1ab8b7bb9c
5
5
  SHA512:
6
- metadata.gz: 26da95b6a6dd459054e700fa3ff906fbc5512dcc0ad2b3cb47e0b5a1a05d2722767605b8f62f044534425ffa4485a53e8132a816792136b37e80c3ff0c20bfbf
7
- data.tar.gz: 9a0d4766e4faeb57353a6d14524e31610e77b84dd9dda33d51ba472db803197cc2989f3c6dc08623ebbc8e95850e331d8a065b9483483a8e78223c3887381283
6
+ metadata.gz: c6e81bbd48d26f2df9b2291e2fa8210d467172696e6e8cf9007326eab8efb5b9687cc6db21d40e96005006b3f2ce0b25abdd2bb26143c5f6833156e1f01b6a97
7
+ data.tar.gz: 05d5510dba6d0a581372c226bb5bc6d1e3f451b4a3b99e47f0ca26558368789706c5250dd3f755f0052a307f3e1562b343abfc33904b8cefd8d4a7f6f6f5e412
@@ -1,3 +1,8 @@
1
+ # Addressable 2.3.7
2
+ - fix scenario in which invalid URIs don't get an exception until inspected
3
+ - handle hostnames with two adjacent periods correctly
4
+ - upgrade of RSpec
5
+
1
6
  # Addressable 2.3.6
2
7
  - normalization drops empty query string
3
8
  - better handling in template extract for missing values
data/Gemfile CHANGED
@@ -8,21 +8,19 @@ group :development do
8
8
  end
9
9
 
10
10
  group :test, :development do
11
- gem 'rake', '>= 0.7.3'
12
- gem 'rspec', '>= 2.9.0'
13
11
  gem 'coveralls', :require => false
14
12
  end
15
13
 
16
14
  gem 'idn', :platform => :mri_18
17
15
  gem 'idn-ruby', :platform => :mri_19
18
16
 
19
- platforms :mri_18 do
17
+ platforms :ruby_18 do
20
18
  gem 'mime-types', '~> 1.25'
19
+ gem 'rest-client', '~> 1.6.0'
21
20
  end
22
21
 
23
22
  platforms :rbx do
24
- gem 'rubysl', '~> 2.0'
25
- gem 'rubinius-coverage'
23
+ gem 'rubysl-openssl', '2.1.0'
26
24
  end
27
25
 
28
26
  gemspec
data/README.md CHANGED
@@ -3,19 +3,22 @@
3
3
  <dl>
4
4
  <dt>Homepage</dt><dd><a href="http://addressable.rubyforge.org/">addressable.rubyforge.org</a></dd>
5
5
  <dt>Author</dt><dd><a href="mailto:bob@sporkmonger.com">Bob Aman</a></dd>
6
- <dt>Copyright</dt><dd>Copyright © 2006-2013 Bob Aman</dd>
6
+ <dt>Copyright</dt><dd>Copyright © 2006-2014 Bob Aman</dd>
7
7
  <dt>License</dt><dd>Apache 2.0</dd>
8
8
  </dl>
9
9
 
10
- [![Gem Version](https://badge.fury.io/rb/addressable.png)][gem]
10
+ [![Gem Version](http://img.shields.io/gem/dt/addressable.svg)][gem]
11
11
  [![Build Status](https://secure.travis-ci.org/sporkmonger/addressable.png?branch=master)][travis]
12
12
  [![Dependency Status](https://gemnasium.com/sporkmonger/addressable.png?travis)][gemnasium]
13
- [![Coverage Status](https://coveralls.io/repos/sporkmonger/addressable/badge.png?branch=master)][coveralls]
13
+ [![Test Coverage Status](https://img.shields.io/coveralls/sporkmonger/addressable.svg)][coveralls]
14
+ [![Documentation Coverage Status](http://inch-ci.org/github/sporkmonger/addressable.svg?branch=master)][inch]
15
+ [![Gittip Donate](http://img.shields.io/gittip/sporkmonger.png)](https://www.gittip.com/sporkmonger/ "Support Open Source Development w/ Gittip")
14
16
 
15
17
  [gem]: https://rubygems.org/gems/addressable
16
18
  [travis]: http://travis-ci.org/sporkmonger/addressable
17
19
  [gemnasium]: https://gemnasium.com/sporkmonger/addressable
18
20
  [coveralls]: https://coveralls.io/r/sporkmonger/addressable
21
+ [inch]: http://inch-ci.org/github/sporkmonger/addressable
19
22
 
20
23
  # Description
21
24
 
@@ -21,23 +21,35 @@ require "idn"
21
21
  module Addressable
22
22
  module IDNA
23
23
  def self.punycode_encode(value)
24
- IDN::Punycode.encode(value)
24
+ IDN::Punycode.encode(value.to_s)
25
25
  end
26
26
 
27
27
  def self.punycode_decode(value)
28
- IDN::Punycode.decode(value)
28
+ IDN::Punycode.decode(value.to_s)
29
29
  end
30
30
 
31
31
  def self.unicode_normalize_kc(value)
32
- IDN::Stringprep.nfkc_normalize(value)
32
+ IDN::Stringprep.nfkc_normalize(value.to_s)
33
33
  end
34
34
 
35
35
  def self.to_ascii(value)
36
- IDN::Idna.toASCII(value)
36
+ value.to_s.split('.', -1).map do |segment|
37
+ if segment.size > 0
38
+ IDN::Idna.toASCII(segment)
39
+ else
40
+ ''
41
+ end
42
+ end.join('.')
37
43
  end
38
44
 
39
45
  def self.to_unicode(value)
40
- IDN::Idna.toUnicode(value)
46
+ value.to_s.split('.', -1).map do |segment|
47
+ if segment.size > 0
48
+ IDN::Idna.toUnicode(segment)
49
+ else
50
+ ''
51
+ end
52
+ end.join('.')
41
53
  end
42
54
  end
43
55
  end
@@ -64,6 +64,7 @@ module Addressable
64
64
  # Converts from a Unicode internationalized domain name to an ASCII
65
65
  # domain name as described in RFC 3490.
66
66
  def self.to_ascii(input)
67
+ input = input.to_s unless input.is_a?(String)
67
68
  input = input.dup
68
69
  if input.respond_to?(:force_encoding)
69
70
  input.force_encoding(Encoding::ASCII_8BIT)
@@ -89,6 +90,7 @@ module Addressable
89
90
  # Converts from an ASCII domain name to a Unicode internationalized
90
91
  # domain name as described in RFC 3490.
91
92
  def self.to_unicode(input)
93
+ input = input.to_s unless input.is_a?(String)
92
94
  parts = input.split('.')
93
95
  parts.map! do |part|
94
96
  if part =~ /^#{ACE_PREFIX}/
@@ -121,6 +123,7 @@ module Addressable
121
123
  # The input string.
122
124
  # @return [String] The downcased result.
123
125
  def self.unicode_downcase(input)
126
+ input = input.to_s unless input.is_a?(String)
124
127
  unpacked = input.unpack("U*")
125
128
  unpacked.map! { |codepoint| lookup_unicode_lowercase(codepoint) }
126
129
  return unpacked.pack("U*")
@@ -376,6 +379,7 @@ module Addressable
376
379
  class PunycodeOverflow < StandardError; end
377
380
 
378
381
  def self.punycode_encode(unicode)
382
+ unicode = unicode.to_s unless unicode.is_a?(String)
379
383
  input = unicode.unpack("U*")
380
384
  output = [0] * (ACE_MAX_LENGTH + 1)
381
385
  input_length = input.size
@@ -803,6 +803,7 @@ module Addressable
803
803
  self.query_values = options[:query_values] if options[:query_values]
804
804
  self.fragment = options[:fragment] if options[:fragment]
805
805
  end
806
+ self.to_s
806
807
  end
807
808
 
808
809
  ##
@@ -22,7 +22,7 @@ if !defined?(Addressable::VERSION)
22
22
  module VERSION
23
23
  MAJOR = 2
24
24
  MINOR = 3
25
- TINY = 6
25
+ TINY = 7
26
26
 
27
27
  STRING = [MAJOR, MINOR, TINY].join('.')
28
28
  end
@@ -23,34 +23,34 @@ require "addressable/idna"
23
23
 
24
24
  shared_examples_for "converting from unicode to ASCII" do
25
25
  it "should convert 'www.google.com' correctly" do
26
- Addressable::IDNA.to_ascii("www.google.com").should == "www.google.com"
26
+ expect(Addressable::IDNA.to_ascii("www.google.com")).to eq("www.google.com")
27
27
  end
28
28
 
29
29
  it "should convert 'www.詹姆斯.com' correctly" do
30
- Addressable::IDNA.to_ascii(
30
+ expect(Addressable::IDNA.to_ascii(
31
31
  "www.詹姆斯.com"
32
- ).should == "www.xn--8ws00zhy3a.com"
32
+ )).to eq("www.xn--8ws00zhy3a.com")
33
33
  end
34
34
 
35
35
  it "should convert 'www.Iñtërnâtiônàlizætiøn.com' correctly" do
36
36
  "www.Iñtërnâtiônàlizætiøn.com"
37
- Addressable::IDNA.to_ascii(
37
+ expect(Addressable::IDNA.to_ascii(
38
38
  "www.I\xC3\xB1t\xC3\xABrn\xC3\xA2ti\xC3\xB4" +
39
39
  "n\xC3\xA0liz\xC3\xA6ti\xC3\xB8n.com"
40
- ).should == "www.xn--itrntinliztin-vdb0a5exd8ewcye.com"
40
+ )).to eq("www.xn--itrntinliztin-vdb0a5exd8ewcye.com")
41
41
  end
42
42
 
43
43
  it "should convert 'www.Iñtërnâtiônàlizætiøn.com' correctly" do
44
- Addressable::IDNA.to_ascii(
44
+ expect(Addressable::IDNA.to_ascii(
45
45
  "www.In\xCC\x83te\xCC\x88rna\xCC\x82tio\xCC\x82n" +
46
46
  "a\xCC\x80liz\xC3\xA6ti\xC3\xB8n.com"
47
- ).should == "www.xn--itrntinliztin-vdb0a5exd8ewcye.com"
47
+ )).to eq("www.xn--itrntinliztin-vdb0a5exd8ewcye.com")
48
48
  end
49
49
 
50
50
  it "should convert " +
51
51
  "'www.ほんとうにながいわけのわからないどめいんめいのらべるまだながくしないとたりない.w3.mag.keio.ac.jp' " +
52
52
  "correctly" do
53
- Addressable::IDNA.to_ascii(
53
+ expect(Addressable::IDNA.to_ascii(
54
54
  "www.\343\201\273\343\202\223\343\201\250\343\201\206\343\201\253\343" +
55
55
  "\201\252\343\201\214\343\201\204\343\202\217\343\201\221\343\201\256" +
56
56
  "\343\202\217\343\201\213\343\202\211\343\201\252\343\201\204\343\201" +
@@ -59,15 +59,16 @@ shared_examples_for "converting from unicode to ASCII" do
59
59
  "\343\201\252\343\201\214\343\201\217\343\201\227\343\201\252\343\201" +
60
60
  "\204\343\201\250\343\201\237\343\202\212\343\201\252\343\201\204." +
61
61
  "w3.mag.keio.ac.jp"
62
- ).should ==
62
+ )).to eq(
63
63
  "www.xn--n8jaaaaai5bhf7as8fsfk3jnknefdde3" +
64
64
  "fg11amb5gzdb4wi9bya3kc6lra.w3.mag.keio.ac.jp"
65
+ )
65
66
  end
66
67
 
67
68
  it "should convert " +
68
69
  "'www.ほんとうにながいわけのわからないどめいんめいのらべるまだながくしないとたりない.w3.mag.keio.ac.jp' " +
69
70
  "correctly" do
70
- Addressable::IDNA.to_ascii(
71
+ expect(Addressable::IDNA.to_ascii(
71
72
  "www.\343\201\273\343\202\223\343\201\250\343\201\206\343\201\253\343" +
72
73
  "\201\252\343\201\213\343\202\231\343\201\204\343\202\217\343\201\221" +
73
74
  "\343\201\256\343\202\217\343\201\213\343\202\211\343\201\252\343\201" +
@@ -77,121 +78,136 @@ shared_examples_for "converting from unicode to ASCII" do
77
78
  "\213\343\202\231\343\201\217\343\201\227\343\201\252\343\201\204\343" +
78
79
  "\201\250\343\201\237\343\202\212\343\201\252\343\201\204." +
79
80
  "w3.mag.keio.ac.jp"
80
- ).should ==
81
+ )).to eq(
81
82
  "www.xn--n8jaaaaai5bhf7as8fsfk3jnknefdde3" +
82
83
  "fg11amb5gzdb4wi9bya3kc6lra.w3.mag.keio.ac.jp"
84
+ )
83
85
  end
84
86
 
85
87
  it "should convert '点心和烤鸭.w3.mag.keio.ac.jp' correctly" do
86
- Addressable::IDNA.to_ascii(
88
+ expect(Addressable::IDNA.to_ascii(
87
89
  "点心和烤鸭.w3.mag.keio.ac.jp"
88
- ).should == "xn--0trv4xfvn8el34t.w3.mag.keio.ac.jp"
90
+ )).to eq("xn--0trv4xfvn8el34t.w3.mag.keio.ac.jp")
89
91
  end
90
92
 
91
93
  it "should convert '가각갂갃간갅갆갇갈갉힢힣.com' correctly" do
92
- Addressable::IDNA.to_ascii(
94
+ expect(Addressable::IDNA.to_ascii(
93
95
  "가각갂갃간갅갆갇갈갉힢힣.com"
94
- ).should == "xn--o39acdefghijk5883jma.com"
96
+ )).to eq("xn--o39acdefghijk5883jma.com")
95
97
  end
96
98
 
97
99
  it "should convert " +
98
100
  "'\347\242\274\346\250\231\346\272\226\350" +
99
101
  "\220\254\345\234\213\347\242\274.com' correctly" do
100
- Addressable::IDNA.to_ascii(
102
+ expect(Addressable::IDNA.to_ascii(
101
103
  "\347\242\274\346\250\231\346\272\226\350" +
102
104
  "\220\254\345\234\213\347\242\274.com"
103
- ).should == "xn--9cs565brid46mda086o.com"
105
+ )).to eq("xn--9cs565brid46mda086o.com")
104
106
  end
105
107
 
106
108
  it "should convert 'リ宠퐱〹.com' correctly" do
107
- Addressable::IDNA.to_ascii(
109
+ expect(Addressable::IDNA.to_ascii(
108
110
  "\357\276\230\345\256\240\355\220\261\343\200\271.com"
109
- ).should == "xn--eek174hoxfpr4k.com"
111
+ )).to eq("xn--eek174hoxfpr4k.com")
110
112
  end
111
113
 
112
114
  it "should convert 'リ宠퐱卄.com' correctly" do
113
- Addressable::IDNA.to_ascii(
115
+ expect(Addressable::IDNA.to_ascii(
114
116
  "\343\203\252\345\256\240\355\220\261\345\215\204.com"
115
- ).should == "xn--eek174hoxfpr4k.com"
117
+ )).to eq("xn--eek174hoxfpr4k.com")
116
118
  end
117
119
 
118
120
  it "should convert 'ᆵ' correctly" do
119
- Addressable::IDNA.to_ascii(
121
+ expect(Addressable::IDNA.to_ascii(
120
122
  "\341\206\265"
121
- ).should == "xn--4ud"
123
+ )).to eq("xn--4ud")
122
124
  end
123
125
 
124
126
  it "should convert 'ᆵ' correctly" do
125
- Addressable::IDNA.to_ascii(
127
+ expect(Addressable::IDNA.to_ascii(
126
128
  "\357\276\257"
127
- ).should == "xn--4ud"
129
+ )).to eq("xn--4ud")
130
+ end
131
+
132
+ it "should handle two adjacent '.'s correctly" do
133
+ expect(Addressable::IDNA.to_ascii(
134
+ "example..host"
135
+ )).to eq("example..host")
128
136
  end
129
137
  end
130
138
 
131
139
  shared_examples_for "converting from ASCII to unicode" do
132
140
  it "should convert 'www.google.com' correctly" do
133
- Addressable::IDNA.to_unicode("www.google.com").should == "www.google.com"
141
+ expect(Addressable::IDNA.to_unicode("www.google.com")).to eq("www.google.com")
134
142
  end
135
143
 
136
144
  it "should convert 'www.詹姆斯.com' correctly" do
137
- Addressable::IDNA.to_unicode(
145
+ expect(Addressable::IDNA.to_unicode(
138
146
  "www.xn--8ws00zhy3a.com"
139
- ).should == "www.詹姆斯.com"
147
+ )).to eq("www.詹姆斯.com")
140
148
  end
141
149
 
142
150
  it "should convert 'www.iñtërnâtiônàlizætiøn.com' correctly" do
143
- Addressable::IDNA.to_unicode(
151
+ expect(Addressable::IDNA.to_unicode(
144
152
  "www.xn--itrntinliztin-vdb0a5exd8ewcye.com"
145
- ).should == "www.iñtërnâtiônàlizætiøn.com"
153
+ )).to eq("www.iñtërnâtiônàlizætiøn.com")
146
154
  end
147
155
 
148
156
  it "should convert " +
149
157
  "'www.ほんとうにながいわけのわからないどめいんめいのらべるまだながくしないとたりない.w3.mag.keio.ac.jp' " +
150
158
  "correctly" do
151
- Addressable::IDNA.to_unicode(
159
+ expect(Addressable::IDNA.to_unicode(
152
160
  "www.xn--n8jaaaaai5bhf7as8fsfk3jnknefdde3" +
153
161
  "fg11amb5gzdb4wi9bya3kc6lra.w3.mag.keio.ac.jp"
154
- ).should ==
162
+ )).to eq(
155
163
  "www.ほんとうにながいわけのわからないどめいんめいのらべるまだながくしないとたりない.w3.mag.keio.ac.jp"
164
+ )
156
165
  end
157
166
 
158
167
  it "should convert '点心和烤鸭.w3.mag.keio.ac.jp' correctly" do
159
- Addressable::IDNA.to_unicode(
168
+ expect(Addressable::IDNA.to_unicode(
160
169
  "xn--0trv4xfvn8el34t.w3.mag.keio.ac.jp"
161
- ).should == "点心和烤鸭.w3.mag.keio.ac.jp"
170
+ )).to eq("点心和烤鸭.w3.mag.keio.ac.jp")
162
171
  end
163
172
 
164
173
  it "should convert '가각갂갃간갅갆갇갈갉힢힣.com' correctly" do
165
- Addressable::IDNA.to_unicode(
174
+ expect(Addressable::IDNA.to_unicode(
166
175
  "xn--o39acdefghijk5883jma.com"
167
- ).should == "가각갂갃간갅갆갇갈갉힢힣.com"
176
+ )).to eq("가각갂갃간갅갆갇갈갉힢힣.com")
168
177
  end
169
178
 
170
179
  it "should convert " +
171
180
  "'\347\242\274\346\250\231\346\272\226\350" +
172
181
  "\220\254\345\234\213\347\242\274.com' correctly" do
173
- Addressable::IDNA.to_unicode(
182
+ expect(Addressable::IDNA.to_unicode(
174
183
  "xn--9cs565brid46mda086o.com"
175
- ).should ==
184
+ )).to eq(
176
185
  "\347\242\274\346\250\231\346\272\226\350" +
177
186
  "\220\254\345\234\213\347\242\274.com"
187
+ )
178
188
  end
179
189
 
180
190
  it "should convert 'リ宠퐱卄.com' correctly" do
181
- Addressable::IDNA.to_unicode(
191
+ expect(Addressable::IDNA.to_unicode(
182
192
  "xn--eek174hoxfpr4k.com"
183
- ).should == "\343\203\252\345\256\240\355\220\261\345\215\204.com"
193
+ )).to eq("\343\203\252\345\256\240\355\220\261\345\215\204.com")
184
194
  end
185
195
 
186
196
  it "should convert 'ᆵ' correctly" do
187
- Addressable::IDNA.to_unicode(
197
+ expect(Addressable::IDNA.to_unicode(
188
198
  "xn--4ud"
189
- ).should == "\341\206\265"
199
+ )).to eq("\341\206\265")
200
+ end
201
+
202
+ it "should handle two adjacent '.'s correctly" do
203
+ expect(Addressable::IDNA.to_unicode(
204
+ "example..host"
205
+ )).to eq("example..host")
190
206
  end
191
207
 
192
208
  it "should normalize 'string' correctly" do
193
- Addressable::IDNA.unicode_normalize_kc(:'string').should == "string"
194
- Addressable::IDNA.unicode_normalize_kc("string").should == "string"
209
+ expect(Addressable::IDNA.unicode_normalize_kc(:'string')).to eq("string")
210
+ expect(Addressable::IDNA.unicode_normalize_kc("string")).to eq("string")
195
211
  end
196
212
  end
197
213
 
@@ -23,6 +23,6 @@ describe Net::HTTP do
23
23
  it "should be compatible with Addressable" do
24
24
  response_body =
25
25
  Net::HTTP.get(Addressable::URI.parse('http://www.google.com/'))
26
- response_body.should_not be_nil
26
+ expect(response_body).not_to be_nil
27
27
  end
28
28
  end
@@ -24,9 +24,9 @@ shared_examples_for 'expands' do |tests|
24
24
  it "#{template} to #{exp}" do
25
25
  tmpl = Addressable::Template.new(template).expand(subject)
26
26
  if expansion.is_a?(Array)
27
- expansion.any?{|i| i == tmpl.to_str}.should be_true
27
+ expect(expansion.any?{|i| i == tmpl.to_str}).to be true
28
28
  else
29
- tmpl.to_str.should == expansion
29
+ expect(tmpl.to_str).to eq(expansion)
30
30
  end
31
31
  end
32
32
  end
@@ -57,20 +57,20 @@ describe "==" do
57
57
  let(:template) { Addressable::Template.new('https://www.example.com/{foo}') }
58
58
  it 'is equal when the pattern matches' do
59
59
  other_template = Addressable::Template.new('https://www.example.com/{foo}')
60
- expect(template).should == other_template
61
- expect(other_template).should == template
60
+ expect(template).to eq other_template
61
+ expect(other_template).to eq template
62
62
  end
63
63
  it 'is not equal when the pattern differs' do
64
64
  other_template = Addressable::Template.new('https://www.example.com/{bar}')
65
- expect(template).should_not == other_template
66
- expect(other_template).should_not == template
65
+ expect(template).not_to eq other_template
66
+ expect(other_template).not_to eq template
67
67
  end
68
68
  it 'is not equal to non-templates' do
69
69
  uri = 'https://www.example.com/foo/bar'
70
70
  addressable_template = Addressable::Template.new uri
71
71
  addressable_uri = Addressable::URI.parse uri
72
- expect(addressable_template).should_not == addressable_uri
73
- expect(addressable_uri).should_not == addressable_template
72
+ expect(addressable_template).not_to eq addressable_uri
73
+ expect(addressable_uri).not_to eq addressable_template
74
74
  end
75
75
  end
76
76
 
@@ -83,7 +83,7 @@ describe "Type conversion" do
83
83
  :hello => 1234,
84
84
  :nothing => nil,
85
85
  :sym => :symbolic,
86
- :decimal => BigDecimal.new(1)
86
+ :decimal => BigDecimal.new('1')
87
87
  }
88
88
  }
89
89
 
@@ -828,24 +828,24 @@ describe Addressable::Template do
828
828
  let(:uri){ "http://example.com/a/b/c/?one=1&two=2#foo" }
829
829
  let(:uri2){ "http://example.com/a/b/c/#foo" }
830
830
  it "should be able to extract with queries" do
831
- template.extract(uri).should == {
831
+ expect(template.extract(uri)).to eq({
832
832
  "host" => "example.com",
833
833
  "segments" => %w(a b c),
834
834
  "one" => "1",
835
835
  "bogus" => nil,
836
836
  "two" => "2",
837
837
  "fragment" => "foo"
838
- }
838
+ })
839
839
  end
840
840
  it "should be able to extract without queries" do
841
- template.extract(uri2).should == {
841
+ expect(template.extract(uri2)).to eq({
842
842
  "host" => "example.com",
843
843
  "segments" => %w(a b c),
844
844
  "one" => nil,
845
845
  "bogus" => nil,
846
846
  "two" => nil,
847
847
  "fragment" => "foo"
848
- }
848
+ })
849
849
  end
850
850
 
851
851
  context "issue #137" do
@@ -853,30 +853,30 @@ describe Addressable::Template do
853
853
 
854
854
  it "can match empty" do
855
855
  data = subject.extract("/path")
856
- data["page"].should == nil
857
- data["per_page"].should == nil
858
- data.keys.sort.should == ['page', 'per_page']
856
+ expect(data["page"]).to eq(nil)
857
+ expect(data["per_page"]).to eq(nil)
858
+ expect(data.keys.sort).to eq(['page', 'per_page'])
859
859
  end
860
860
 
861
861
  it "can match first var" do
862
862
  data = subject.extract("/path?page=1")
863
- data["page"].should == "1"
864
- data["per_page"].should == nil
865
- data.keys.sort.should == ['page', 'per_page']
863
+ expect(data["page"]).to eq("1")
864
+ expect(data["per_page"]).to eq(nil)
865
+ expect(data.keys.sort).to eq(['page', 'per_page'])
866
866
  end
867
867
 
868
868
  it "can match second var" do
869
869
  data = subject.extract("/path?per_page=1")
870
- data["page"].should == nil
871
- data["per_page"].should == "1"
872
- data.keys.sort.should == ['page', 'per_page']
870
+ expect(data["page"]).to eq(nil)
871
+ expect(data["per_page"]).to eq("1")
872
+ expect(data.keys.sort).to eq(['page', 'per_page'])
873
873
  end
874
874
 
875
875
  it "can match both vars" do
876
876
  data = subject.extract("/path?page=2&per_page=1")
877
- data["page"].should == "2"
878
- data["per_page"].should == "1"
879
- data.keys.sort.should == ['page', 'per_page']
877
+ expect(data["page"]).to eq("2")
878
+ expect(data["per_page"]).to eq("1")
879
+ expect(data.keys.sort).to eq(['page', 'per_page'])
880
880
  end
881
881
  end
882
882
  end
@@ -887,8 +887,9 @@ describe Addressable::Template do
887
887
  Addressable::Template.new("http://example.com/{one}/{two}/")
888
888
  }
889
889
  it "builds a new pattern" do
890
- subject.partial_expand(:one => "1").pattern.should ==
890
+ expect(subject.partial_expand(:one => "1").pattern).to eq(
891
891
  "http://example.com/1/{two}/"
892
+ )
892
893
  end
893
894
  end
894
895
  context "partial_expand query with missing param in middle" do
@@ -896,8 +897,9 @@ describe Addressable::Template do
896
897
  Addressable::Template.new("http://example.com/{?one,two,three}/")
897
898
  }
898
899
  it "builds a new pattern" do
899
- subject.partial_expand(:one => "1", :three => "3").pattern.should ==
900
+ expect(subject.partial_expand(:one => "1", :three => "3").pattern).to eq(
900
901
  "http://example.com/?one=1{&two}&three=3/"
902
+ )
901
903
  end
902
904
  end
903
905
  context "partial_expand with query string" do
@@ -905,8 +907,9 @@ describe Addressable::Template do
905
907
  Addressable::Template.new("http://example.com/{?two,one}/")
906
908
  }
907
909
  it "builds a new pattern" do
908
- subject.partial_expand(:one => "1").pattern.should ==
910
+ expect(subject.partial_expand(:one => "1").pattern).to eq(
909
911
  "http://example.com/{?two}&one=1/"
912
+ )
910
913
  end
911
914
  end
912
915
  context "partial_expand with path operator" do
@@ -914,8 +917,9 @@ describe Addressable::Template do
914
917
  Addressable::Template.new("http://example.com{/one,two}/")
915
918
  }
916
919
  it "builds a new pattern" do
917
- subject.partial_expand(:one => "1").pattern.should ==
920
+ expect(subject.partial_expand(:one => "1").pattern).to eq(
918
921
  "http://example.com/1{/two}/"
922
+ )
919
923
  end
920
924
  end
921
925
  end
@@ -925,8 +929,9 @@ describe Addressable::Template do
925
929
  Addressable::Template.new("http://example.com/{one}/{two}/")
926
930
  }
927
931
  it "builds a new pattern" do
928
- subject.partial_expand("one" => "1").pattern.should ==
932
+ expect(subject.partial_expand("one" => "1").pattern).to eq(
929
933
  "http://example.com/1/{two}/"
934
+ )
930
935
  end
931
936
  end
932
937
  context "partial_expand query with missing param in middle" do
@@ -934,8 +939,9 @@ describe Addressable::Template do
934
939
  Addressable::Template.new("http://example.com/{?one,two,three}/")
935
940
  }
936
941
  it "builds a new pattern" do
937
- subject.partial_expand("one" => "1", "three" => "3").pattern.should ==
942
+ expect(subject.partial_expand("one" => "1", "three" => "3").pattern).to eq(
938
943
  "http://example.com/?one=1{&two}&three=3/"
944
+ )
939
945
  end
940
946
  end
941
947
  context "partial_expand with query string" do
@@ -943,8 +949,9 @@ describe Addressable::Template do
943
949
  Addressable::Template.new("http://example.com/{?two,one}/")
944
950
  }
945
951
  it "builds a new pattern" do
946
- subject.partial_expand("one" => "1").pattern.should ==
952
+ expect(subject.partial_expand("one" => "1").pattern).to eq(
947
953
  "http://example.com/{?two}&one=1/"
954
+ )
948
955
  end
949
956
  end
950
957
  context "partial_expand with path operator" do
@@ -952,8 +959,9 @@ describe Addressable::Template do
952
959
  Addressable::Template.new("http://example.com{/one,two}/")
953
960
  }
954
961
  it "builds a new pattern" do
955
- subject.partial_expand("one" => "1").pattern.should ==
962
+ expect(subject.partial_expand("one" => "1").pattern).to eq(
956
963
  "http://example.com/1{/two}/"
964
+ )
957
965
  end
958
966
  end
959
967
  end
@@ -963,15 +971,16 @@ describe Addressable::Template do
963
971
  Addressable::Template.new("http://example.com/search/{query}/")
964
972
  }
965
973
  it "processes spaces" do
966
- subject.expand({"query" => "an example search query"},
967
- ExampleTwoProcessor).to_str.should ==
974
+ expect(subject.expand({"query" => "an example search query"},
975
+ ExampleTwoProcessor).to_str).to eq(
968
976
  "http://example.com/search/an+example+search+query/"
977
+ )
969
978
  end
970
979
  it "validates" do
971
- lambda{
980
+ expect{
972
981
  subject.expand({"query" => "Bogus!"},
973
982
  ExampleTwoProcessor).to_str
974
- }.should raise_error(Addressable::Template::InvalidTemplateValueError)
983
+ }.to raise_error(Addressable::Template::InvalidTemplateValueError)
975
984
  end
976
985
  end
977
986
  context "partial_expand query with missing param in middle" do
@@ -979,8 +988,9 @@ describe Addressable::Template do
979
988
  Addressable::Template.new("http://example.com/{?one,two,three}/")
980
989
  }
981
990
  it "builds a new pattern" do
982
- subject.partial_expand("one" => "1", "three" => "3").pattern.should ==
991
+ expect(subject.partial_expand("one" => "1", "three" => "3").pattern).to eq(
983
992
  "http://example.com/?one=1{&two}&three=3/"
993
+ )
984
994
  end
985
995
  end
986
996
  context "partial_expand with query string" do
@@ -988,8 +998,9 @@ describe Addressable::Template do
988
998
  Addressable::Template.new("http://example.com/{?two,one}/")
989
999
  }
990
1000
  it "builds a new pattern" do
991
- subject.partial_expand("one" => "1").pattern.should ==
1001
+ expect(subject.partial_expand("one" => "1").pattern).to eq(
992
1002
  "http://example.com/{?two}&one=1/"
1003
+ )
993
1004
  end
994
1005
  end
995
1006
  context "partial_expand with path operator" do
@@ -997,8 +1008,9 @@ describe Addressable::Template do
997
1008
  Addressable::Template.new("http://example.com{/one,two}/")
998
1009
  }
999
1010
  it "builds a new pattern" do
1000
- subject.partial_expand("one" => "1").pattern.should ==
1011
+ expect(subject.partial_expand("one" => "1").pattern).to eq(
1001
1012
  "http://example.com/1{/two}/"
1013
+ )
1002
1014
  end
1003
1015
  end
1004
1016
  end
@@ -1007,20 +1019,20 @@ describe Addressable::Template do
1007
1019
  subject { Addressable::Template.new("foo{foo}/{bar}baz") }
1008
1020
  it "can match" do
1009
1021
  data = subject.match("foofoo/bananabaz")
1010
- data.mapping["foo"].should == "foo"
1011
- data.mapping["bar"].should == "banana"
1022
+ expect(data.mapping["foo"]).to eq("foo")
1023
+ expect(data.mapping["bar"]).to eq("banana")
1012
1024
  end
1013
1025
  it "can fail" do
1014
- subject.match("bar/foo").should be_nil
1015
- subject.match("foobaz").should be_nil
1026
+ expect(subject.match("bar/foo")).to be_nil
1027
+ expect(subject.match("foobaz")).to be_nil
1016
1028
  end
1017
1029
  it "can match empty" do
1018
1030
  data = subject.match("foo/baz")
1019
- data.mapping["foo"].should == nil
1020
- data.mapping["bar"].should == nil
1031
+ expect(data.mapping["foo"]).to eq(nil)
1032
+ expect(data.mapping["bar"]).to eq(nil)
1021
1033
  end
1022
1034
  it "lists vars" do
1023
- subject.variables.should == ["foo", "bar"]
1035
+ expect(subject.variables).to eq(["foo", "bar"])
1024
1036
  end
1025
1037
  end
1026
1038
 
@@ -1028,27 +1040,27 @@ describe Addressable::Template do
1028
1040
  subject { Addressable::Template.new("foo{+foo}{#bar}baz") }
1029
1041
  it "can match" do
1030
1042
  data = subject.match("foo/test/banana#bazbaz")
1031
- data.mapping["foo"].should == "/test/banana"
1032
- data.mapping["bar"].should == "baz"
1043
+ expect(data.mapping["foo"]).to eq("/test/banana")
1044
+ expect(data.mapping["bar"]).to eq("baz")
1033
1045
  end
1034
1046
  it "can match empty level 2 #" do
1035
1047
  data = subject.match("foo/test/bananabaz")
1036
- data.mapping["foo"].should == "/test/banana"
1037
- data.mapping["bar"].should == nil
1048
+ expect(data.mapping["foo"]).to eq("/test/banana")
1049
+ expect(data.mapping["bar"]).to eq(nil)
1038
1050
  data = subject.match("foo/test/banana#baz")
1039
- data.mapping["foo"].should == "/test/banana"
1040
- data.mapping["bar"].should == ""
1051
+ expect(data.mapping["foo"]).to eq("/test/banana")
1052
+ expect(data.mapping["bar"]).to eq("")
1041
1053
  end
1042
1054
  it "can match empty level 2 +" do
1043
1055
  data = subject.match("foobaz")
1044
- data.mapping["foo"].should == nil
1045
- data.mapping["bar"].should == nil
1056
+ expect(data.mapping["foo"]).to eq(nil)
1057
+ expect(data.mapping["bar"]).to eq(nil)
1046
1058
  data = subject.match("foo#barbaz")
1047
- data.mapping["foo"].should == nil
1048
- data.mapping["bar"].should == "bar"
1059
+ expect(data.mapping["foo"]).to eq(nil)
1060
+ expect(data.mapping["bar"]).to eq("bar")
1049
1061
  end
1050
1062
  it "lists vars" do
1051
- subject.variables.should == ["foo", "bar"]
1063
+ expect(subject.variables).to eq(["foo", "bar"])
1052
1064
  end
1053
1065
  end
1054
1066
 
@@ -1057,56 +1069,56 @@ describe Addressable::Template do
1057
1069
  subject { Addressable::Template.new("foo{foo,bar}baz") }
1058
1070
  it "can match" do
1059
1071
  data = subject.match("foofoo,barbaz")
1060
- data.mapping["foo"].should == "foo"
1061
- data.mapping["bar"].should == "bar"
1072
+ expect(data.mapping["foo"]).to eq("foo")
1073
+ expect(data.mapping["bar"]).to eq("bar")
1062
1074
  end
1063
1075
  it "lists vars" do
1064
- subject.variables.should == ["foo", "bar"]
1076
+ expect(subject.variables).to eq(["foo", "bar"])
1065
1077
  end
1066
1078
  end
1067
1079
  context "+ operator" do
1068
1080
  subject { Addressable::Template.new("foo{+foo,bar}baz") }
1069
1081
  it "can match" do
1070
1082
  data = subject.match("foofoo/bar,barbaz")
1071
- data.mapping["bar"].should == "foo/bar,bar"
1072
- data.mapping["foo"].should == ""
1083
+ expect(data.mapping["bar"]).to eq("foo/bar,bar")
1084
+ expect(data.mapping["foo"]).to eq("")
1073
1085
  end
1074
1086
  it "lists vars" do
1075
- subject.variables.should == ["foo", "bar"]
1087
+ expect(subject.variables).to eq(["foo", "bar"])
1076
1088
  end
1077
1089
  end
1078
1090
  context ". operator" do
1079
1091
  subject { Addressable::Template.new("foo{.foo,bar}baz") }
1080
1092
  it "can match" do
1081
1093
  data = subject.match("foo.foo.barbaz")
1082
- data.mapping["foo"].should == "foo"
1083
- data.mapping["bar"].should == "bar"
1094
+ expect(data.mapping["foo"]).to eq("foo")
1095
+ expect(data.mapping["bar"]).to eq("bar")
1084
1096
  end
1085
1097
  it "lists vars" do
1086
- subject.variables.should == ["foo", "bar"]
1098
+ expect(subject.variables).to eq(["foo", "bar"])
1087
1099
  end
1088
1100
  end
1089
1101
  context "/ operator" do
1090
1102
  subject { Addressable::Template.new("foo{/foo,bar}baz") }
1091
1103
  it "can match" do
1092
1104
  data = subject.match("foo/foo/barbaz")
1093
- data.mapping["foo"].should == "foo"
1094
- data.mapping["bar"].should == "bar"
1105
+ expect(data.mapping["foo"]).to eq("foo")
1106
+ expect(data.mapping["bar"]).to eq("bar")
1095
1107
  end
1096
1108
  it "lists vars" do
1097
- subject.variables.should == ["foo", "bar"]
1109
+ expect(subject.variables).to eq(["foo", "bar"])
1098
1110
  end
1099
1111
  end
1100
1112
  context "; operator" do
1101
1113
  subject { Addressable::Template.new("foo{;foo,bar,baz}baz") }
1102
1114
  it "can match" do
1103
1115
  data = subject.match("foo;foo=bar%20baz;bar=foo;bazbaz")
1104
- data.mapping["foo"].should == "bar baz"
1105
- data.mapping["bar"].should == "foo"
1106
- data.mapping["baz"].should == ""
1116
+ expect(data.mapping["foo"]).to eq("bar baz")
1117
+ expect(data.mapping["bar"]).to eq("foo")
1118
+ expect(data.mapping["baz"]).to eq("")
1107
1119
  end
1108
1120
  it "lists vars" do
1109
- subject.variables.should == %w(foo bar baz)
1121
+ expect(subject.variables).to eq(%w(foo bar baz))
1110
1122
  end
1111
1123
  end
1112
1124
  context "? operator" do
@@ -1114,11 +1126,11 @@ describe Addressable::Template do
1114
1126
  subject { Addressable::Template.new("foo{?foo,bar}baz") }
1115
1127
  it "can match" do
1116
1128
  data = subject.match("foo?foo=bar%20baz&bar=foobaz")
1117
- data.mapping["foo"].should == "bar baz"
1118
- data.mapping["bar"].should == "foo"
1129
+ expect(data.mapping["foo"]).to eq("bar baz")
1130
+ expect(data.mapping["bar"]).to eq("foo")
1119
1131
  end
1120
1132
  it "lists vars" do
1121
- subject.variables.should == %w(foo bar)
1133
+ expect(subject.variables).to eq(%w(foo bar))
1122
1134
  end
1123
1135
  end
1124
1136
 
@@ -1127,30 +1139,30 @@ describe Addressable::Template do
1127
1139
 
1128
1140
  it "can match empty" do
1129
1141
  data = subject.match("/path")
1130
- data.mapping["page"].should == nil
1131
- data.mapping["per_page"].should == nil
1132
- data.mapping.keys.sort.should == ['page', 'per_page']
1142
+ expect(data.mapping["page"]).to eq(nil)
1143
+ expect(data.mapping["per_page"]).to eq(nil)
1144
+ expect(data.mapping.keys.sort).to eq(['page', 'per_page'])
1133
1145
  end
1134
1146
 
1135
1147
  it "can match first var" do
1136
1148
  data = subject.match("/path?page=1")
1137
- data.mapping["page"].should == "1"
1138
- data.mapping["per_page"].should == nil
1139
- data.mapping.keys.sort.should == ['page', 'per_page']
1149
+ expect(data.mapping["page"]).to eq("1")
1150
+ expect(data.mapping["per_page"]).to eq(nil)
1151
+ expect(data.mapping.keys.sort).to eq(['page', 'per_page'])
1140
1152
  end
1141
1153
 
1142
1154
  it "can match second var" do
1143
1155
  data = subject.match("/path?per_page=1")
1144
- data.mapping["page"].should == nil
1145
- data.mapping["per_page"].should == "1"
1146
- data.mapping.keys.sort.should == ['page', 'per_page']
1156
+ expect(data.mapping["page"]).to eq(nil)
1157
+ expect(data.mapping["per_page"]).to eq("1")
1158
+ expect(data.mapping.keys.sort).to eq(['page', 'per_page'])
1147
1159
  end
1148
1160
 
1149
1161
  it "can match both vars" do
1150
1162
  data = subject.match("/path?page=2&per_page=1")
1151
- data.mapping["page"].should == "2"
1152
- data.mapping["per_page"].should == "1"
1153
- data.mapping.keys.sort.should == ['page', 'per_page']
1163
+ expect(data.mapping["page"]).to eq("2")
1164
+ expect(data.mapping["per_page"]).to eq("1")
1165
+ expect(data.mapping.keys.sort).to eq(['page', 'per_page'])
1154
1166
  end
1155
1167
  end
1156
1168
 
@@ -1158,11 +1170,11 @@ describe Addressable::Template do
1158
1170
  subject { Addressable::Template.new("http://cyberscore.dev/api/users{?username}") }
1159
1171
  it "can match" do
1160
1172
  data = subject.match("http://cyberscore.dev/api/users?username=foobaz")
1161
- data.mapping["username"].should == "foobaz"
1173
+ expect(data.mapping["username"]).to eq("foobaz")
1162
1174
  end
1163
1175
  it "lists vars" do
1164
- subject.variables.should == %w(username)
1165
- subject.keys.should == %w(username)
1176
+ expect(subject.variables).to eq(%w(username))
1177
+ expect(subject.keys).to eq(%w(username))
1166
1178
  end
1167
1179
  end
1168
1180
  end
@@ -1170,11 +1182,11 @@ describe Addressable::Template do
1170
1182
  subject { Addressable::Template.new("foo{&foo,bar}baz") }
1171
1183
  it "can match" do
1172
1184
  data = subject.match("foo&foo=bar%20baz&bar=foobaz")
1173
- data.mapping["foo"].should == "bar baz"
1174
- data.mapping["bar"].should == "foo"
1185
+ expect(data.mapping["foo"]).to eq("bar baz")
1186
+ expect(data.mapping["bar"]).to eq("foo")
1175
1187
  end
1176
1188
  it "lists vars" do
1177
- subject.variables.should == %w(foo bar)
1189
+ expect(subject.variables).to eq(%w(foo bar))
1178
1190
  end
1179
1191
  end
1180
1192
  end
@@ -1184,70 +1196,70 @@ describe Addressable::Template do
1184
1196
  context "EXPRESSION" do
1185
1197
  subject { Addressable::Template::EXPRESSION }
1186
1198
  it "should be able to match an expression" do
1187
- subject.should match("{foo}")
1188
- subject.should match("{foo,9}")
1189
- subject.should match("{foo.bar,baz}")
1190
- subject.should match("{+foo.bar,baz}")
1191
- subject.should match("{foo,foo%20bar}")
1192
- subject.should match("{#foo:20,baz*}")
1193
- subject.should match("stuff{#foo:20,baz*}things")
1199
+ expect(subject).to match("{foo}")
1200
+ expect(subject).to match("{foo,9}")
1201
+ expect(subject).to match("{foo.bar,baz}")
1202
+ expect(subject).to match("{+foo.bar,baz}")
1203
+ expect(subject).to match("{foo,foo%20bar}")
1204
+ expect(subject).to match("{#foo:20,baz*}")
1205
+ expect(subject).to match("stuff{#foo:20,baz*}things")
1194
1206
  end
1195
1207
  it "should fail on non vars" do
1196
- subject.should_not match("!{foo")
1197
- subject.should_not match("{foo.bar.}")
1198
- subject.should_not match("!{}")
1208
+ expect(subject).not_to match("!{foo")
1209
+ expect(subject).not_to match("{foo.bar.}")
1210
+ expect(subject).not_to match("!{}")
1199
1211
  end
1200
1212
  end
1201
1213
  context "VARNAME" do
1202
1214
  subject { Addressable::Template::VARNAME }
1203
1215
  it "should be able to match a variable" do
1204
- subject.should match("foo")
1205
- subject.should match("9")
1206
- subject.should match("foo.bar")
1207
- subject.should match("foo_bar")
1208
- subject.should match("foo_bar.baz")
1209
- subject.should match("foo%20bar")
1210
- subject.should match("foo%20bar.baz")
1216
+ expect(subject).to match("foo")
1217
+ expect(subject).to match("9")
1218
+ expect(subject).to match("foo.bar")
1219
+ expect(subject).to match("foo_bar")
1220
+ expect(subject).to match("foo_bar.baz")
1221
+ expect(subject).to match("foo%20bar")
1222
+ expect(subject).to match("foo%20bar.baz")
1211
1223
  end
1212
1224
  it "should fail on non vars" do
1213
- subject.should_not match("!foo")
1214
- subject.should_not match("foo.bar.")
1215
- subject.should_not match("foo%2%00bar")
1216
- subject.should_not match("foo_ba%r")
1217
- subject.should_not match("foo_bar*")
1218
- subject.should_not match("foo_bar:20")
1225
+ expect(subject).not_to match("!foo")
1226
+ expect(subject).not_to match("foo.bar.")
1227
+ expect(subject).not_to match("foo%2%00bar")
1228
+ expect(subject).not_to match("foo_ba%r")
1229
+ expect(subject).not_to match("foo_bar*")
1230
+ expect(subject).not_to match("foo_bar:20")
1219
1231
  end
1220
1232
  end
1221
1233
  context "VARIABLE_LIST" do
1222
1234
  subject { Addressable::Template::VARIABLE_LIST }
1223
1235
  it "should be able to match a variable list" do
1224
- subject.should match("foo,bar")
1225
- subject.should match("foo")
1226
- subject.should match("foo,bar*,baz")
1227
- subject.should match("foo.bar,bar_baz*,baz:12")
1236
+ expect(subject).to match("foo,bar")
1237
+ expect(subject).to match("foo")
1238
+ expect(subject).to match("foo,bar*,baz")
1239
+ expect(subject).to match("foo.bar,bar_baz*,baz:12")
1228
1240
  end
1229
1241
  it "should fail on non vars" do
1230
- subject.should_not match(",foo,bar*,baz")
1231
- subject.should_not match("foo,*bar,baz")
1232
- subject.should_not match("foo,,bar*,baz")
1242
+ expect(subject).not_to match(",foo,bar*,baz")
1243
+ expect(subject).not_to match("foo,*bar,baz")
1244
+ expect(subject).not_to match("foo,,bar*,baz")
1233
1245
  end
1234
1246
  end
1235
1247
  context "VARSPEC" do
1236
1248
  subject { Addressable::Template::VARSPEC }
1237
1249
  it "should be able to match a variable with modifier" do
1238
- subject.should match("9:8")
1239
- subject.should match("foo.bar*")
1240
- subject.should match("foo_bar:12")
1241
- subject.should match("foo_bar.baz*")
1242
- subject.should match("foo%20bar:12")
1243
- subject.should match("foo%20bar.baz*")
1250
+ expect(subject).to match("9:8")
1251
+ expect(subject).to match("foo.bar*")
1252
+ expect(subject).to match("foo_bar:12")
1253
+ expect(subject).to match("foo_bar.baz*")
1254
+ expect(subject).to match("foo%20bar:12")
1255
+ expect(subject).to match("foo%20bar.baz*")
1244
1256
  end
1245
1257
  it "should fail on non vars" do
1246
- subject.should_not match("!foo")
1247
- subject.should_not match("*foo")
1248
- subject.should_not match("fo*o")
1249
- subject.should_not match("fo:o")
1250
- subject.should_not match("foo:")
1258
+ expect(subject).not_to match("!foo")
1259
+ expect(subject).not_to match("*foo")
1260
+ expect(subject).not_to match("fo*o")
1261
+ expect(subject).not_to match("fo:o")
1262
+ expect(subject).not_to match("foo:")
1251
1263
  end
1252
1264
  end
1253
1265
  end
@@ -1272,45 +1284,45 @@ describe Addressable::Template::MatchData do
1272
1284
 
1273
1285
  describe 'values_at' do
1274
1286
  it 'returns an array with the values' do
1275
- its.values_at(0, 2).should == ['ab/cd', 'cd']
1287
+ expect(its.values_at(0, 2)).to eq(['ab/cd', 'cd'])
1276
1288
  end
1277
1289
  it 'allows mixing integer an string keys' do
1278
- its.values_at('foo', 1).should == ['ab', 'ab']
1290
+ expect(its.values_at('foo', 1)).to eq(['ab', 'ab'])
1279
1291
  end
1280
1292
  it 'accepts unknown keys' do
1281
- its.values_at('baz', 'foo').should == [nil, 'ab']
1293
+ expect(its.values_at('baz', 'foo')).to eq([nil, 'ab'])
1282
1294
  end
1283
1295
  end
1284
1296
 
1285
1297
  describe '[]' do
1286
1298
  context 'string key' do
1287
1299
  it 'returns the corresponding capture' do
1288
- its['foo'].should == 'ab'
1289
- its['bar'].should == 'cd'
1300
+ expect(its['foo']).to eq('ab')
1301
+ expect(its['bar']).to eq('cd')
1290
1302
  end
1291
1303
  it 'returns nil for unknown keys' do
1292
- its['baz'].should be_nil
1304
+ expect(its['baz']).to be_nil
1293
1305
  end
1294
1306
  end
1295
1307
  context 'symbol key' do
1296
1308
  it 'returns the corresponding capture' do
1297
- its[:foo].should == 'ab'
1298
- its[:bar].should == 'cd'
1309
+ expect(its[:foo]).to eq('ab')
1310
+ expect(its[:bar]).to eq('cd')
1299
1311
  end
1300
1312
  it 'returns nil for unknown keys' do
1301
- its[:baz].should be_nil
1313
+ expect(its[:baz]).to be_nil
1302
1314
  end
1303
1315
  end
1304
1316
  context 'integer key' do
1305
1317
  it 'returns the full URI for index 0' do
1306
- its[0].should == 'ab/cd'
1318
+ expect(its[0]).to eq('ab/cd')
1307
1319
  end
1308
1320
  it 'returns the corresponding capture' do
1309
- its[1].should == 'ab'
1310
- its[2].should == 'cd'
1321
+ expect(its[1]).to eq('ab')
1322
+ expect(its[2]).to eq('cd')
1311
1323
  end
1312
1324
  it 'returns nil for unknown keys' do
1313
- its[3].should be_nil
1325
+ expect(its[3]).to be_nil
1314
1326
  end
1315
1327
  end
1316
1328
  context 'other key' do
@@ -1320,8 +1332,8 @@ describe Addressable::Template::MatchData do
1320
1332
  end
1321
1333
  context 'with length' do
1322
1334
  it 'returns an array starting at index with given length' do
1323
- its[0, 2].should == ['ab/cd', 'ab']
1324
- its[2, 1].should == ['cd']
1335
+ expect(its[0, 2]).to eq(['ab/cd', 'ab'])
1336
+ expect(its[2, 1]).to eq(['cd'])
1325
1337
  end
1326
1338
  end
1327
1339
  end