mongrel2 0.38.0 → 0.39.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.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/History.rdoc +6 -0
  5. data/Manifest.txt +5 -3
  6. data/Rakefile +2 -2
  7. data/data/mongrel2/config.sql +6 -1
  8. data/lib/mongrel2.rb +5 -2
  9. data/lib/mongrel2/config.rb +1 -0
  10. data/lib/mongrel2/config/server.rb +15 -0
  11. data/lib/mongrel2/config/xrequest.rb +45 -0
  12. data/lib/mongrel2/connection.rb +4 -5
  13. data/lib/mongrel2/control.rb +2 -2
  14. data/lib/mongrel2/handler.rb +1 -1
  15. data/spec/{lib/constants.rb → constants.rb} +0 -2
  16. data/spec/{lib/helpers.rb → helpers.rb} +9 -12
  17. data/spec/{lib/matchers.rb → matchers.rb} +2 -12
  18. data/spec/mongrel2/config/directory_spec.rb +16 -27
  19. data/spec/mongrel2/config/dsl_spec.rb +115 -98
  20. data/spec/mongrel2/config/filter_spec.rb +1 -12
  21. data/spec/mongrel2/config/handler_spec.rb +23 -33
  22. data/spec/mongrel2/config/host_spec.rb +1 -12
  23. data/spec/mongrel2/config/log_spec.rb +13 -24
  24. data/spec/mongrel2/config/proxy_spec.rb +1 -12
  25. data/spec/mongrel2/config/route_spec.rb +5 -15
  26. data/spec/mongrel2/config/server_spec.rb +23 -34
  27. data/spec/mongrel2/config/setting_spec.rb +1 -12
  28. data/spec/mongrel2/config/statistic_spec.rb +1 -12
  29. data/spec/mongrel2/config/xrequest_spec.rb +19 -0
  30. data/spec/mongrel2/config_spec.rb +17 -29
  31. data/spec/mongrel2/connection_spec.rb +41 -53
  32. data/spec/mongrel2/constants_spec.rb +2 -14
  33. data/spec/mongrel2/control_spec.rb +44 -56
  34. data/spec/mongrel2/handler_spec.rb +64 -76
  35. data/spec/mongrel2/httprequest_spec.rb +21 -31
  36. data/spec/mongrel2/httpresponse_spec.rb +55 -67
  37. data/spec/mongrel2/request_spec.rb +53 -62
  38. data/spec/mongrel2/response_spec.rb +15 -24
  39. data/spec/mongrel2/table_spec.rb +41 -53
  40. data/spec/mongrel2/websocket_spec.rb +95 -104
  41. data/spec/mongrel2_spec.rb +3 -12
  42. metadata +13 -11
  43. metadata.gz.sig +0 -0
@@ -1,22 +1,13 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- BEGIN {
4
- require 'pathname'
5
- basedir = Pathname.new( __FILE__ ).dirname.parent.parent
6
-
7
- libdir = basedir + "lib"
8
-
9
- $LOAD_PATH.unshift( basedir ) unless $LOAD_PATH.include?( basedir )
10
- $LOAD_PATH.unshift( libdir ) unless $LOAD_PATH.include?( libdir )
11
- }
3
+ require_relative '../helpers'
12
4
 
13
5
  require 'rspec'
6
+
14
7
  require 'tnetstring'
15
8
  require 'tmpdir'
16
9
  require 'tempfile'
17
10
 
18
- require 'spec/lib/helpers'
19
-
20
11
  require 'mongrel2'
21
12
  require 'mongrel2/request'
22
13
 
@@ -28,7 +19,7 @@ require 'mongrel2/request'
28
19
  describe Mongrel2::Request do
29
20
 
30
21
  before( :all ) do
31
- setup_logging( :fatal )
22
+ setup_logging()
32
23
  @factory = Mongrel2::RequestFactory.new( route: '/form' )
33
24
  end
34
25
 
@@ -42,12 +33,12 @@ describe Mongrel2::Request do
42
33
  message = make_request()
43
34
  req = Mongrel2::Request.parse( message )
44
35
 
45
- req.should be_a( Mongrel2::Request )
46
- req.sender_id.should == TEST_UUID
47
- req.conn_id.should == TEST_ID
36
+ expect( req ).to be_a( Mongrel2::Request )
37
+ expect( req.sender_id ).to eq( TEST_UUID )
38
+ expect( req.conn_id ).to eq( TEST_ID )
48
39
 
49
- req.headers.should be_a( Mongrel2::Table )
50
- req.headers['Host'].should == TEST_HEADERS['host']
40
+ expect( req.headers ).to be_a( Mongrel2::Table )
41
+ expect( req.headers['Host'] ).to eq( TEST_HEADERS['host'] )
51
42
  end
52
43
 
53
44
  it "can parse a request message with TNetstring headers" do
@@ -55,12 +46,12 @@ describe Mongrel2::Request do
55
46
  message = make_tn_request()
56
47
  req = Mongrel2::Request.parse( message )
57
48
 
58
- req.should be_a( Mongrel2::Request )
59
- req.sender_id.should == TEST_UUID
60
- req.conn_id.should == TEST_ID
49
+ expect( req ).to be_a( Mongrel2::Request )
50
+ expect( req.sender_id ).to eq( TEST_UUID )
51
+ expect( req.conn_id ).to eq( TEST_ID )
61
52
 
62
- req.headers.should be_a( Mongrel2::Table )
63
- req.headers.host.should == TEST_HEADERS['host']
53
+ expect( req.headers ).to be_a( Mongrel2::Table )
54
+ expect( req.headers.host ).to eq( TEST_HEADERS['host'] )
64
55
  end
65
56
 
66
57
  it "can parse a request message with a JSON body" do
@@ -68,14 +59,14 @@ describe Mongrel2::Request do
68
59
  message = make_json_request()
69
60
  req = Mongrel2::Request.parse( message )
70
61
 
71
- req.should be_a( Mongrel2::JSONRequest )
72
- req.sender_id.should == TEST_UUID
73
- req.conn_id.should == TEST_ID
62
+ expect( req ).to be_a( Mongrel2::JSONRequest )
63
+ expect( req.sender_id ).to eq( TEST_UUID )
64
+ expect( req.conn_id ).to eq( TEST_ID )
74
65
 
75
- req.headers.should be_a( Mongrel2::Table )
76
- req.headers.path.should == TEST_JSON_PATH
66
+ expect( req.headers ).to be_a( Mongrel2::Table )
67
+ expect( req.headers.path ).to eq( TEST_JSON_PATH )
77
68
 
78
- req.data.should == TEST_JSON_BODY
69
+ expect( req.data ).to eq( TEST_JSON_BODY )
79
70
  end
80
71
 
81
72
  it "raises an UnhandledMethodError with the name of the method for METHOD verbs that " +
@@ -86,7 +77,7 @@ describe Mongrel2::Request do
86
77
  end
87
78
 
88
79
  it "knows what kind of response it should return" do
89
- Mongrel2::Request.response_class.should == Mongrel2::Response
80
+ expect( Mongrel2::Request.response_class ).to eq( Mongrel2::Response )
90
81
  end
91
82
 
92
83
 
@@ -99,39 +90,39 @@ describe Mongrel2::Request do
99
90
 
100
91
  it "can return an appropriate response instance for themselves" do
101
92
  result = @req.response
102
- result.should be_a( Mongrel2::Response )
103
- result.sender_id.should == @req.sender_id
104
- result.conn_id.should == @req.conn_id
93
+ expect( result ).to be_a( Mongrel2::Response )
94
+ expect( result.sender_id ).to eq( @req.sender_id )
95
+ expect( result.conn_id ).to eq( @req.conn_id )
105
96
  end
106
97
 
107
98
  it "remembers its response if it's already made one" do
108
- @req.response.should equal( @req.response )
99
+ expect( @req.response ).to equal( @req.response )
109
100
  end
110
101
 
111
102
  it "allows the entity body to be replaced by assigning a String" do
112
103
  @req.body = 'something else'
113
- @req.body.should be_a( StringIO )
114
- @req.body.string.should == 'something else'
104
+ expect( @req.body ).to be_a( StringIO )
105
+ expect( @req.body.string ).to eq( 'something else' )
115
106
  end
116
107
 
117
108
  it "doesn't try to wrap non-stringish entity body replacements in a StringIO" do
118
109
  testobj = Object.new
119
110
  @req.body = testobj
120
- @req.body.should be( testobj )
111
+ expect( @req.body ).to be( testobj )
121
112
  end
122
113
 
123
114
  it "provides a convenience method for fetching the requestor's IP address" do
124
115
  @req.headers.merge!(
125
116
  'X-Forwarded-For' => '127.0.0.1'
126
117
  )
127
- @req.remote_ip.to_s.should == '127.0.0.1'
118
+ expect( @req.remote_ip.to_s ).to eq( '127.0.0.1' )
128
119
  end
129
120
 
130
121
  it "fetching the requestor's IP address even when travelling via proxies" do
131
122
  @req.headers.merge!(
132
123
  'X-Forwarded-For' => [ '127.0.0.1', '8.8.8.8', '4.4.4.4' ]
133
124
  )
134
- @req.remote_ip.to_s.should == '127.0.0.1'
125
+ expect( @req.remote_ip.to_s ).to eq( '127.0.0.1' )
135
126
  end
136
127
 
137
128
  end
@@ -143,21 +134,21 @@ describe Mongrel2::Request do
143
134
  body = "some data".encode( 'binary' )
144
135
  req = @factory.post( '/form', body, content_type: 'text/plain; charset=iso-8859-1' )
145
136
 
146
- req.body.string.encoding.should be( Encoding::ISO_8859_1 )
137
+ expect( req.body.string.encoding ).to be( Encoding::ISO_8859_1 )
147
138
  end
148
139
 
149
140
  it "keeps the data as ascii-8bit if no charset is in the content-type header" do
150
141
  body = "some data".encode( 'binary' )
151
142
  req = @factory.post( '/form', body, content_type: 'application/octet-stream' )
152
143
 
153
- req.body.string.encoding.should be( Encoding::ASCII_8BIT )
144
+ expect( req.body.string.encoding ).to be( Encoding::ASCII_8BIT )
154
145
  end
155
146
 
156
147
  it "keeps the data as ascii-8bit if there is no content-type header" do
157
148
  body = "some data".encode( 'binary' )
158
149
  req = @factory.post( '/form', body )
159
150
 
160
- req.body.string.encoding.should be( Encoding::ASCII_8BIT )
151
+ expect( req.body.string.encoding ).to be( Encoding::ASCII_8BIT )
161
152
  end
162
153
 
163
154
  end
@@ -185,9 +176,9 @@ describe Mongrel2::Request do
185
176
  register_request_type self, :__default
186
177
  end
187
178
 
188
- Mongrel2::Request.subclass_for_method( 'GET' ).should == subclass
189
- Mongrel2::Request.subclass_for_method( 'POST' ).should == subclass
190
- Mongrel2::Request.subclass_for_method( 'JSON' ).should == subclass
179
+ expect( Mongrel2::Request.subclass_for_method( 'GET' ) ).to eq( subclass )
180
+ expect( Mongrel2::Request.subclass_for_method( 'POST' ) ).to eq( subclass )
181
+ expect( Mongrel2::Request.subclass_for_method( 'JSON' ) ).to eq( subclass )
191
182
  end
192
183
 
193
184
  it "includes a mechanism for overriding the Request subclass for a particular request " +
@@ -196,9 +187,9 @@ describe Mongrel2::Request do
196
187
  register_request_type self, :GET
197
188
  end
198
189
 
199
- Mongrel2::Request.subclass_for_method( 'GET' ).should == subclass
200
- Mongrel2::Request.subclass_for_method( 'POST' ).should_not == subclass
201
- Mongrel2::Request.subclass_for_method( 'JSON' ).should_not == subclass
190
+ expect( Mongrel2::Request.subclass_for_method( 'GET' ) ).to eq( subclass )
191
+ expect( Mongrel2::Request.subclass_for_method( 'POST' ) ).to_not eq( subclass )
192
+ expect( Mongrel2::Request.subclass_for_method( 'JSON' ) ).to_not eq( subclass )
202
193
  end
203
194
 
204
195
  it "clears any cached method -> subclass lookups when the default subclass changes" do
@@ -208,7 +199,7 @@ describe Mongrel2::Request do
208
199
  register_request_type self, :__default
209
200
  end
210
201
 
211
- Mongrel2::Request.subclass_for_method( 'OPTIONS' ).should == subclass
202
+ expect( Mongrel2::Request.subclass_for_method( 'OPTIONS' ) ).to eq( subclass )
212
203
  end
213
204
 
214
205
  end
@@ -243,8 +234,8 @@ describe Mongrel2::Request do
243
234
  it "knows if it's an 'async upload started' notification" do
244
235
  req = @factory.post( '/form', '', x_mongrel2_upload_start: @spoolpath )
245
236
 
246
- req.should be_upload_started()
247
- req.should_not be_upload_done()
237
+ expect( req ).to be_upload_started()
238
+ expect( req ).to_not be_upload_done()
248
239
  end
249
240
 
250
241
  it "knows if it's an 'async upload done' notification" do
@@ -252,9 +243,9 @@ describe Mongrel2::Request do
252
243
  x_mongrel2_upload_start: @spoolpath,
253
244
  x_mongrel2_upload_done: @spoolpath )
254
245
 
255
- req.should_not be_upload_started()
256
- req.should be_upload_done()
257
- req.should be_valid_upload()
246
+ expect( req ).to_not be_upload_started()
247
+ expect( req ).to be_upload_done()
248
+ expect( req ).to be_valid_upload()
258
249
  end
259
250
 
260
251
  it "knows if it's not a valid 'async upload done' notification" do
@@ -262,9 +253,9 @@ describe Mongrel2::Request do
262
253
  x_mongrel2_upload_start: @spoolpath,
263
254
  x_mongrel2_upload_done: '/etc/passwd' )
264
255
 
265
- req.should_not be_upload_started()
266
- req.should be_upload_done()
267
- req.should_not be_valid_upload()
256
+ expect( req ).to_not be_upload_started()
257
+ expect( req ).to be_upload_done()
258
+ expect( req ).to_not be_valid_upload()
268
259
  end
269
260
 
270
261
  it "raises an exception if the uploaded file fetched with mismatched headers" do
@@ -282,10 +273,10 @@ describe Mongrel2::Request do
282
273
  x_mongrel2_upload_start: @spoolpath,
283
274
  x_mongrel2_upload_done: @spoolpath )
284
275
 
285
- req.should be_valid_upload()
276
+ expect( req ).to be_valid_upload()
286
277
 
287
- req.uploaded_file.should be_a( Pathname )
288
- req.uploaded_file.to_s.should == @spoolfile.path
278
+ expect( req.uploaded_file ).to be_a( Pathname )
279
+ expect( req.uploaded_file.to_s ).to eq( @spoolfile.path )
289
280
  end
290
281
 
291
282
  it "sets the body of the request to the uploaded File if it's valid" do
@@ -293,10 +284,10 @@ describe Mongrel2::Request do
293
284
  x_mongrel2_upload_start: @spoolpath,
294
285
  x_mongrel2_upload_done: @spoolpath )
295
286
 
296
- req.should be_valid_upload()
287
+ expect( req ).to be_valid_upload()
297
288
 
298
- req.body.should be_a( File )
299
- req.body.path.should == @spoolfile.path
289
+ expect( req.body ).to be_a( File )
290
+ expect( req.body.path ).to eq( @spoolfile.path )
300
291
  end
301
292
 
302
293
  end
@@ -1,19 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- BEGIN {
4
- require 'pathname'
5
- basedir = Pathname.new( __FILE__ ).dirname.parent.parent
6
-
7
- libdir = basedir + "lib"
8
-
9
- $LOAD_PATH.unshift( basedir ) unless $LOAD_PATH.include?( basedir )
10
- $LOAD_PATH.unshift( libdir ) unless $LOAD_PATH.include?( libdir )
11
- }
3
+ require_relative '../helpers'
12
4
 
13
5
  require 'rspec'
14
- require 'tnetstring'
15
6
 
16
- require 'spec/lib/helpers'
7
+ require 'tnetstring'
17
8
 
18
9
  require 'mongrel2'
19
10
  require 'mongrel2/request'
@@ -27,7 +18,7 @@ require 'mongrel2/response'
27
18
  describe Mongrel2::Response do
28
19
 
29
20
  before( :all ) do
30
- setup_logging( :fatal )
21
+ setup_logging()
31
22
  end
32
23
 
33
24
  after( :all ) do
@@ -39,21 +30,21 @@ describe Mongrel2::Response do
39
30
  req = Mongrel2::Request.new( TEST_UUID, 8, '/path', {}, '' )
40
31
  response = Mongrel2::Response.from_request( req )
41
32
 
42
- response.should be_a( Mongrel2::Response )
43
- response.sender_id.should == req.sender_id
44
- response.conn_id.should == req.conn_id
45
- response.request.should equal( req )
33
+ expect( response ).to be_a( Mongrel2::Response )
34
+ expect( response.sender_id ).to eq( req.sender_id )
35
+ expect( response.conn_id ).to eq( req.conn_id )
36
+ expect( response.request ).to equal( req )
46
37
  end
47
38
 
48
39
 
49
40
  it "can be created with a body" do
50
41
  response = Mongrel2::Response.new( TEST_UUID, 8, 'the body' )
51
- response.body.read.should == 'the body'
42
+ expect( response.body.read ).to eq( 'the body' )
52
43
  end
53
44
 
54
45
  it "stringifies to its body contents" do
55
46
  response = Mongrel2::Response.new( TEST_UUID, 8, 'the body' )
56
- response.to_s.should == 'the body'
47
+ expect( response.to_s ).to eq( 'the body' )
57
48
  end
58
49
 
59
50
  it "can be streamed in chunks" do
@@ -64,15 +55,15 @@ describe Mongrel2::Response do
64
55
  it "wraps stringifiable bodies set via the #body= accessor in a StringIO" do
65
56
  response = Mongrel2::Response.new( TEST_UUID, 8 )
66
57
  response.body = 'a stringioed body'
67
- response.body.should be_a( StringIO )
68
- response.body.string.should == 'a stringioed body'
58
+ expect( response.body ).to be_a( StringIO )
59
+ expect( response.body.string ).to eq( 'a stringioed body' )
69
60
  end
70
61
 
71
62
  it "doesn't try to wrap non-stringfiable bodies in a StringIO" do
72
63
  response = Mongrel2::Response.new( TEST_UUID, 8 )
73
64
  testbody = Object.new
74
65
  response.body = testbody
75
- response.body.should be( testbody )
66
+ expect( response.body ).to be( testbody )
76
67
  end
77
68
 
78
69
  context "an instance with default values" do
@@ -83,19 +74,19 @@ describe Mongrel2::Response do
83
74
 
84
75
  it "has an empty-IO body" do
85
76
  @response.body.rewind
86
- @response.body.read.should == ''
77
+ expect( @response.body.read ).to eq( '' )
87
78
  end
88
79
 
89
80
  it "supports the append operator to append objects to the body IO" do
90
81
  @response << 'some body stuff' << ' and some more body stuff'
91
82
  @response.body.rewind
92
- @response.body.read.should == 'some body stuff and some more body stuff'
83
+ expect( @response.body.read ).to eq( 'some body stuff and some more body stuff' )
93
84
  end
94
85
 
95
86
  it "supports #puts for appending objects to the body IO separated by EOL" do
96
87
  @response.puts( "some body stuff\n", " and some more body stuff\n\n", :and_a_symbol )
97
88
  @response.body.rewind
98
- @response.body.read.should == "some body stuff\n and some more body stuff\n\nand_a_symbol\n"
89
+ expect( @response.body.read ).to eq( "some body stuff\n and some more body stuff\n\nand_a_symbol\n" )
99
90
  end
100
91
 
101
92
  end
@@ -1,18 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- BEGIN {
4
- require 'pathname'
5
- basedir = Pathname.new( __FILE__ ).dirname.parent.parent
6
-
7
- libdir = basedir + "lib"
8
-
9
- $LOAD_PATH.unshift( basedir ) unless $LOAD_PATH.include?( basedir )
10
- $LOAD_PATH.unshift( libdir ) unless $LOAD_PATH.include?( libdir )
11
- }
12
-
13
- require 'rspec'
14
-
15
- require 'spec/lib/helpers'
3
+ require_relative '../helpers'
16
4
 
17
5
  require 'mongrel2'
18
6
  require 'mongrel2/table'
@@ -26,7 +14,7 @@ describe Mongrel2::Table do
26
14
 
27
15
 
28
16
  before( :all ) do
29
- setup_logging( :fatal )
17
+ setup_logging()
30
18
  end
31
19
 
32
20
  before( :each ) do
@@ -46,38 +34,38 @@ describe Mongrel2::Table do
46
34
  @table[:accept_encoding] = :accept_encoding
47
35
  @table.accept_encoding = :accept_encoding
48
36
 
49
- @table['accept'].should == :accept
50
- @table['ACCEPT'].should == :accept
51
- @table['Accept'].should == :accept
52
- @table[:accept].should == :accept
53
- @table.accept.should == :accept
54
-
55
- @table['USER-AGENT'].should == :user_agent
56
- @table['User-Agent'].should == :user_agent
57
- @table['user-agent'].should == :user_agent
58
- @table[:user_agent].should == :user_agent
59
- @table.user_agent.should == :user_agent
60
-
61
- @table['ACCEPT-ENCODING'].should == :accept_encoding
62
- @table['Accept-Encoding'].should == :accept_encoding
63
- @table['accept-encoding'].should == :accept_encoding
64
- @table[:accept_encoding].should == :accept_encoding
65
- @table.accept_encoding.should == :accept_encoding
37
+ expect( @table['accept'] ).to eq( :accept )
38
+ expect( @table['ACCEPT'] ).to eq( :accept )
39
+ expect( @table['Accept'] ).to eq( :accept )
40
+ expect( @table[:accept] ).to eq( :accept )
41
+ expect( @table.accept ).to eq( :accept )
42
+
43
+ expect( @table['USER-AGENT'] ).to eq( :user_agent )
44
+ expect( @table['User-Agent'] ).to eq( :user_agent )
45
+ expect( @table['user-agent'] ).to eq( :user_agent )
46
+ expect( @table[:user_agent] ).to eq( :user_agent )
47
+ expect( @table.user_agent ).to eq( :user_agent )
48
+
49
+ expect( @table['ACCEPT-ENCODING'] ).to eq( :accept_encoding )
50
+ expect( @table['Accept-Encoding'] ).to eq( :accept_encoding )
51
+ expect( @table['accept-encoding'] ).to eq( :accept_encoding )
52
+ expect( @table[:accept_encoding] ).to eq( :accept_encoding )
53
+ expect( @table.accept_encoding ).to eq( :accept_encoding )
66
54
  end
67
55
 
68
56
 
69
57
  it "should assign a new value when appending to a non-existing key" do
70
58
  @table.append( 'indian-meal' => 'pinecones' )
71
- @table['Indian-Meal'].should == 'pinecones'
59
+ expect( @table['Indian-Meal'] ).to eq( 'pinecones' )
72
60
  end
73
61
 
74
62
 
75
63
  it "should create an array value and append when appending to an existing key" do
76
64
  @table[:indian_meal] = 'pork sausage'
77
65
  @table.append( 'Indian-MEAL' => 'pinecones' )
78
- @table['Indian-Meal'].should have(2).members
79
- @table['Indian-Meal'].should include('pinecones')
80
- @table['Indian-Meal'].should include('pork sausage')
66
+ expect( @table['Indian-Meal'] ).to have(2).members
67
+ expect( @table['Indian-Meal'] ).to include('pinecones')
68
+ expect( @table['Indian-Meal'] ).to include('pork sausage')
81
69
  end
82
70
 
83
71
 
@@ -86,9 +74,9 @@ describe Mongrel2::Table do
86
74
 
87
75
  table = Mongrel2::Table.new({ :bob => :dan, 'Bob' => :dan_too })
88
76
 
89
- table[:bob].should have(2).members
90
- table['Bob'].should include( :dan )
91
- table['bob'].should include( :dan_too )
77
+ expect( table[:bob] ).to have(2).members
78
+ expect( table['Bob'] ).to include( :dan )
79
+ expect( table['bob'] ).to include( :dan_too )
92
80
  end
93
81
 
94
82
 
@@ -100,9 +88,9 @@ describe Mongrel2::Table do
100
88
 
101
89
  table.append( 'x-ice-cream-flavor' => 'banana' )
102
90
 
103
- table.to_s.should =~ %r{Accept: text/html\r\n}
104
- table.to_s.should =~ %r{X-Ice-Cream-Flavor: mango\r\n}
105
- table.to_s.should =~ %r{X-Ice-Cream-Flavor: banana\r\n}
91
+ expect( table.to_s ).to match( %r{Accept: text/html\r\n} )
92
+ expect( table.to_s ).to match( %r{X-Ice-Cream-Flavor: mango\r\n} )
93
+ expect( table.to_s ).to match( %r{X-Ice-Cream-Flavor: banana\r\n} )
106
94
  end
107
95
 
108
96
 
@@ -115,8 +103,8 @@ describe Mongrel2::Table do
115
103
  othertable['cookie'] = 'peanut butter'
116
104
 
117
105
  ot = @table.merge( othertable )
118
- ot['accept'].should == 'thing'
119
- ot['cookie'].should == 'peanut butter'
106
+ expect( ot['accept'] ).to eq( 'thing' )
107
+ expect( ot['cookie'] ).to eq( 'peanut butter' )
120
108
  end
121
109
 
122
110
 
@@ -127,8 +115,8 @@ describe Mongrel2::Table do
127
115
  hash = { 'CookiE_FLAVOR' => 'peanut butter' }
128
116
 
129
117
  ot = @table.merge( hash )
130
- ot['accept'].should == 'thing'
131
- ot['cookie-flavor'].should == 'peanut butter'
118
+ expect( ot['accept'] ).to eq( 'thing' )
119
+ expect( ot['cookie-flavor'] ).to eq( 'peanut butter' )
132
120
  end
133
121
 
134
122
 
@@ -141,9 +129,9 @@ describe Mongrel2::Table do
141
129
  newtable[:foom] << " and another string"
142
130
  newtable[:frong][3].replace( "mississipi" )
143
131
 
144
- @table.should_not include( 'idkfa' )
145
- @table[:foom].should == 'a string'
146
- @table[:frong][3].should == 'moe'
132
+ expect( @table ).to_not include( 'idkfa' )
133
+ expect( @table[:foom] ).to eq( 'a string' )
134
+ expect( @table[:frong][3] ).to eq( 'moe' )
147
135
  end
148
136
 
149
137
 
@@ -153,7 +141,7 @@ describe Mongrel2::Table do
153
141
  @table['porntipsguzzardo'] = 'cha-ching'
154
142
 
155
143
  results = @table.values_at( :idspispopd, 'PornTipsGuzzARDO' )
156
- results.should == [ 'ghosty', 'cha-ching' ]
144
+ expect( results ).to eq( [ 'ghosty', 'cha-ching' ] )
157
145
  end
158
146
 
159
147
 
@@ -168,14 +156,14 @@ describe Mongrel2::Table do
168
156
  values << [ header, value ]
169
157
  end
170
158
 
171
- values.flatten.should have(8).members
172
- values.transpose[0].should include( 'Thai-Food', 'With-Absinthe', 'A-Number-Of-Some-Sort' )
173
- values.transpose[1].should include( 'normally good', 'seldom hot enough', 'questionable', '2' )
159
+ expect( values.flatten ).to have(8).members
160
+ expect( values.transpose[0] ).to include( 'Thai-Food', 'With-Absinthe', 'A-Number-Of-Some-Sort' )
161
+ expect( values.transpose[1] ).to include( 'normally good', 'seldom hot enough', 'questionable', '2' )
174
162
  end
175
163
 
176
164
 
177
165
  it "can yield an Enumerator for its header iterator" do
178
- @table.each_header.should be_a( Enumerator )
166
+ expect( @table.each_header ).to be_a( Enumerator )
179
167
  end
180
168
  end
181
169