impuri 0.9.0 → 0.11.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.
@@ -4,8 +4,8 @@ gem 'minitest'
4
4
 
5
5
  $LOAD_PATH.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'lib')))
6
6
 
7
- require 'ImpURI'
8
- require 'minitest/global_expectations/autorun'
7
+ require 'impuri'
8
+ require 'minitest/autorun'
9
9
 
10
10
  describe ImpURI do
11
11
 
@@ -13,810 +13,786 @@ describe ImpURI do
13
13
 
14
14
  describe 'a very simple http URI' do
15
15
 
16
- before do
17
- @impuri = ImpURI.new('http://example.com')
18
- end
16
+ let(:impuri){ImpURI.new('http://example.com')}
19
17
 
20
18
  it 'must parse out the scheme' do
21
- @impuri.scheme.must_equal 'http'
22
- @impuri.protocol.must_equal 'http'
23
- @impuri.scheme_name.must_equal 'http'
19
+ _(impuri.scheme).must_equal 'http'
20
+ _(impuri.protocol).must_equal 'http'
21
+ _(impuri.scheme_name).must_equal 'http'
24
22
  end
25
23
 
26
24
  it 'must parse out the domain name' do
27
- @impuri.hostname.must_equal 'example.com'
28
- @impuri.host.must_equal 'example.com'
25
+ _(impuri.hostname).must_equal 'example.com'
26
+ _(impuri.host).must_equal 'example.com'
29
27
  end
30
28
 
31
29
  it 'must return nil if there is no path' do
32
- @impuri.path.must_be_nil
30
+ _(impuri.path).must_be_nil
33
31
  end
34
32
 
35
33
  it 'must return nil if there are no GET request parameters' do
36
- @impuri.parameter_string.must_be_nil
37
- @impuri.parameters.must_be_nil
34
+ _(impuri.parameter_string).must_be_nil
35
+ _(impuri.parameters).must_be_nil
38
36
  end
39
37
 
40
38
  it 'must return false for has_userinfo?()' do
41
- @impuri.has_userinfo?.must_equal false
42
- @impuri.has_credentials?.must_equal false
43
- @impuri.has_username_and_password?.must_equal false
44
- @impuri.has_user_info?.must_equal false
39
+ _(impuri.has_userinfo?).must_equal false
40
+ _(impuri.has_credentials?).must_equal false
41
+ _(impuri.has_username_and_password?).must_equal false
42
+ _(impuri.has_user_info?).must_equal false
45
43
  end
46
44
 
47
45
  it 'must return true for has_scheme?()' do
48
- @impuri.has_scheme?.must_equal true
49
- @impuri.has_protocol?.must_equal true
50
- @impuri.has_scheme_name?.must_equal true
51
- @impuri.scheme?.must_equal true
52
- @impuri.protocol?.must_equal true
53
- @impuri.scheme_name?.must_equal true
46
+ _(impuri.has_scheme?).must_equal true
47
+ _(impuri.has_protocol?).must_equal true
48
+ _(impuri.has_scheme_name?).must_equal true
49
+ _(impuri.scheme?).must_equal true
50
+ _(impuri.protocol?).must_equal true
51
+ _(impuri.scheme_name?).must_equal true
54
52
  end
55
53
 
56
54
  it 'must return false for has_colon_path_separator?()' do
57
- @impuri.has_colon_path_separator?.must_equal false
58
- @impuri.uses_colon_path_separator?.must_equal false
55
+ _(impuri.has_colon_path_separator?).must_equal false
56
+ _(impuri.uses_colon_path_separator?).must_equal false
59
57
  end
60
58
 
61
59
  it 'must return false for has_port_number?()' do
62
- @impuri.has_port_number?.must_equal false
63
- @impuri.has_port?.must_equal false
64
- @impuri.has_portnumber?.must_equal false
65
- @impuri.port_number?.must_equal false
66
- @impuri.port?.must_equal false
67
- @impuri.portnumber?.must_equal false
60
+ _(impuri.has_port_number?).must_equal false
61
+ _(impuri.has_port?).must_equal false
62
+ _(impuri.has_portnumber?).must_equal false
63
+ _(impuri.port_number?).must_equal false
64
+ _(impuri.port?).must_equal false
65
+ _(impuri.portnumber?).must_equal false
68
66
  end
69
67
 
70
68
  it 'must return nil if there is no request URI' do
71
- @impuri.request_uri.must_be_nil
69
+ _(impuri.request_uri).must_be_nil
72
70
  end
73
71
  end # describe 'a very simple http URI'
74
72
 
75
73
  describe 'an http URI with a port number' do
76
- before do
77
- @impuri = ImpURI.new('http://example.com:8080')
78
- end
74
+ let(:impuri){ImpURI.new('http://example.com:8080')}
79
75
 
80
76
  it 'must parse out the scheme' do
81
- @impuri.scheme.must_equal 'http'
82
- @impuri.protocol.must_equal 'http'
83
- @impuri.scheme_name.must_equal 'http'
77
+ _(impuri.scheme).must_equal 'http'
78
+ _(impuri.protocol).must_equal 'http'
79
+ _(impuri.scheme_name).must_equal 'http'
84
80
  end
85
81
 
86
82
  it 'must parse out the domain name' do
87
- @impuri.hostname.must_equal 'example.com'
88
- @impuri.host.must_equal 'example.com'
83
+ _(impuri.hostname).must_equal 'example.com'
84
+ _(impuri.host).must_equal 'example.com'
89
85
  end
90
86
 
91
87
  it 'must return nil if there is no path' do
92
- @impuri.path.must_be_nil
88
+ _(impuri.path).must_be_nil
93
89
  end
94
90
 
95
91
  it 'must parse out the port number' do
96
- @impuri.port.must_equal '8080'
97
- @impuri.portnumber.must_equal '8080'
98
- @impuri.port_number.must_equal '8080'
92
+ _(impuri.port).must_equal '8080'
93
+ _(impuri.portnumber).must_equal '8080'
94
+ _(impuri.port_number).must_equal '8080'
99
95
  end
100
96
 
101
97
  it 'must return nil if there are no GET request parameters' do
102
- @impuri.parameter_string.must_be_nil
103
- @impuri.parameters.must_be_nil
98
+ _(impuri.parameter_string).must_be_nil
99
+ _(impuri.parameters).must_be_nil
104
100
  end
105
101
 
106
102
  it 'must return false for has_userinfo?()' do
107
- @impuri.has_userinfo?.must_equal false
108
- @impuri.has_credentials?.must_equal false
109
- @impuri.has_username_and_password?.must_equal false
110
- @impuri.has_user_info?.must_equal false
103
+ _(impuri.has_userinfo?).must_equal false
104
+ _(impuri.has_credentials?).must_equal false
105
+ _(impuri.has_username_and_password?).must_equal false
106
+ _(impuri.has_user_info?).must_equal false
111
107
  end
112
108
 
113
109
  it 'must return true for has_scheme?()' do
114
- @impuri.has_scheme?.must_equal true
115
- @impuri.has_protocol?.must_equal true
116
- @impuri.has_scheme_name?.must_equal true
117
- @impuri.scheme?.must_equal true
118
- @impuri.protocol?.must_equal true
119
- @impuri.scheme_name?.must_equal true
110
+ _(impuri.has_scheme?).must_equal true
111
+ _(impuri.has_protocol?).must_equal true
112
+ _(impuri.has_scheme_name?).must_equal true
113
+ _(impuri.scheme?).must_equal true
114
+ _(impuri.protocol?).must_equal true
115
+ _(impuri.scheme_name?).must_equal true
120
116
  end
121
117
 
122
118
  it 'must return false for has_colon_path_separator?()' do
123
- @impuri.has_colon_path_separator?.must_equal false
124
- @impuri.uses_colon_path_separator?.must_equal false
119
+ _(impuri.has_colon_path_separator?).must_equal false
120
+ _(impuri.uses_colon_path_separator?).must_equal false
125
121
  end
126
122
 
127
123
  it 'must return true for has_port_number?()' do
128
- @impuri.has_port_number?.must_equal true
129
- @impuri.has_port?.must_equal true
130
- @impuri.has_portnumber?.must_equal true
131
- @impuri.port_number?.must_equal true
132
- @impuri.port?.must_equal true
133
- @impuri.portnumber?.must_equal true
124
+ _(impuri.has_port_number?).must_equal true
125
+ _(impuri.has_port?).must_equal true
126
+ _(impuri.has_portnumber?).must_equal true
127
+ _(impuri.port_number?).must_equal true
128
+ _(impuri.port?).must_equal true
129
+ _(impuri.portnumber?).must_equal true
134
130
  end
135
131
 
136
132
  it 'must return nil if there is no request URI' do
137
- @impuri.request_uri.must_be_nil
133
+ _(impuri.request_uri).must_be_nil
138
134
  end
139
135
  end # describe 'an http URI with a port number'
140
136
 
141
137
  describe 'an http URI with a path' do
142
- before do
143
- @impuri = ImpURI.new('http://example.com/path/to/resource')
144
- end
138
+ let(:impuri){ImpURI.new('http://example.com/path/to/resource')}
145
139
 
146
140
  it 'must parse out the scheme' do
147
- @impuri.scheme.must_equal 'http'
148
- @impuri.protocol.must_equal 'http'
149
- @impuri.scheme_name.must_equal 'http'
141
+ _(impuri.scheme).must_equal 'http'
142
+ _(impuri.protocol).must_equal 'http'
143
+ _(impuri.scheme_name).must_equal 'http'
150
144
  end
151
145
 
152
146
  it 'must parse out the domain name' do
153
- @impuri.hostname.must_equal 'example.com'
154
- @impuri.host.must_equal 'example.com'
147
+ _(impuri.hostname).must_equal 'example.com'
148
+ _(impuri.host).must_equal 'example.com'
155
149
  end
156
150
 
157
151
  it 'must parse out the path' do
158
- @impuri.path.must_equal '/path/to/resource'
152
+ _(impuri.path).must_equal '/path/to/resource'
159
153
  end
160
154
 
161
155
  it 'must return nil if there are no GET request parameters' do
162
- @impuri.parameter_string.must_be_nil
163
- @impuri.parameters.must_be_nil
156
+ _(impuri.parameter_string).must_be_nil
157
+ _(impuri.parameters).must_be_nil
164
158
  end
165
159
 
166
160
  it 'must return false for has_userinfo?()' do
167
- @impuri.has_userinfo?.must_equal false
168
- @impuri.has_credentials?.must_equal false
169
- @impuri.has_username_and_password?.must_equal false
170
- @impuri.has_user_info?.must_equal false
161
+ _(impuri.has_userinfo?).must_equal false
162
+ _(impuri.has_credentials?).must_equal false
163
+ _(impuri.has_username_and_password?).must_equal false
164
+ _(impuri.has_user_info?).must_equal false
171
165
  end
172
166
 
173
167
  it 'must return true for has_scheme?()' do
174
- @impuri.has_scheme?.must_equal true
175
- @impuri.has_protocol?.must_equal true
176
- @impuri.has_scheme_name?.must_equal true
177
- @impuri.scheme?.must_equal true
178
- @impuri.protocol?.must_equal true
179
- @impuri.scheme_name?.must_equal true
168
+ _(impuri.has_scheme?).must_equal true
169
+ _(impuri.has_protocol?).must_equal true
170
+ _(impuri.has_scheme_name?).must_equal true
171
+ _(impuri.scheme?).must_equal true
172
+ _(impuri.protocol?).must_equal true
173
+ _(impuri.scheme_name?).must_equal true
180
174
  end
181
175
 
182
176
  it 'must return false for has_colon_path_separator?()' do
183
- @impuri.has_colon_path_separator?.must_equal false
184
- @impuri.uses_colon_path_separator?.must_equal false
177
+ _(impuri.has_colon_path_separator?).must_equal false
178
+ _(impuri.uses_colon_path_separator?).must_equal false
185
179
  end
186
180
 
187
181
  it 'must return false for has_port_number?()' do
188
- @impuri.has_port_number?.must_equal false
189
- @impuri.has_port?.must_equal false
190
- @impuri.has_portnumber?.must_equal false
191
- @impuri.port_number?.must_equal false
192
- @impuri.port?.must_equal false
193
- @impuri.portnumber?.must_equal false
182
+ _(impuri.has_port_number?).must_equal false
183
+ _(impuri.has_port?).must_equal false
184
+ _(impuri.has_portnumber?).must_equal false
185
+ _(impuri.port_number?).must_equal false
186
+ _(impuri.port?).must_equal false
187
+ _(impuri.portnumber?).must_equal false
194
188
  end
195
189
 
196
190
  it 'must return the request URI' do
197
- @impuri.request_uri.must_equal '/path/to/resource'
191
+ _(impuri.request_uri).must_equal '/path/to/resource'
198
192
  end
199
193
  end # describe 'an http URI with a path'
200
194
 
201
195
  describe 'an http URI with a username' do
202
- before do
203
- @impuri = ImpURI.new('http://user@example.com/')
204
- end
196
+ let(:impuri){ImpURI.new('http://user@example.com/')}
205
197
 
206
198
  it 'must parse out the scheme' do
207
- @impuri.scheme.must_equal 'http'
208
- @impuri.protocol.must_equal 'http'
209
- @impuri.scheme_name.must_equal 'http'
199
+ _(impuri.scheme).must_equal 'http'
200
+ _(impuri.protocol).must_equal 'http'
201
+ _(impuri.scheme_name).must_equal 'http'
210
202
  end
211
203
 
212
204
  it 'must parse out the domain name' do
213
- @impuri.hostname.must_equal 'example.com'
214
- @impuri.host.must_equal 'example.com'
205
+ _(impuri.hostname).must_equal 'example.com'
206
+ _(impuri.host).must_equal 'example.com'
215
207
  end
216
208
 
217
209
  it 'must parse out the username' do
218
- @impuri.username.must_equal 'user'
210
+ _(impuri.username).must_equal 'user'
219
211
  end
220
212
 
221
213
  it 'must return the userinfo string' do
222
- @impuri.userinfo.must_equal 'user'
223
- @impuri.credentials.must_equal 'user'
224
- @impuri.username_and_password.must_equal 'user'
225
- @impuri.user_info.must_equal 'user'
214
+ _(impuri.userinfo).must_equal 'user'
215
+ _(impuri.credentials).must_equal 'user'
216
+ _(impuri.username_and_password).must_equal 'user'
217
+ _(impuri.user_info).must_equal 'user'
226
218
  end
227
219
 
228
220
  it 'must return nil if there are no GET request parameters' do
229
- @impuri.parameter_string.must_be_nil
230
- @impuri.parameters.must_be_nil
221
+ _(impuri.parameter_string).must_be_nil
222
+ _(impuri.parameters).must_be_nil
231
223
  end
232
224
 
233
225
  it 'must return true for has_userinfo?()' do
234
- @impuri.has_userinfo?.must_equal true
235
- @impuri.has_credentials?.must_equal true
236
- @impuri.has_username_and_password?.must_equal true
237
- @impuri.has_user_info?.must_equal true
226
+ _(impuri.has_userinfo?).must_equal true
227
+ _(impuri.has_credentials?).must_equal true
228
+ _(impuri.has_username_and_password?).must_equal true
229
+ _(impuri.has_user_info?).must_equal true
238
230
  end
239
231
 
240
232
  it 'must return true for has_scheme?()' do
241
- @impuri.has_scheme?.must_equal true
242
- @impuri.has_protocol?.must_equal true
243
- @impuri.has_scheme_name?.must_equal true
244
- @impuri.scheme?.must_equal true
245
- @impuri.protocol?.must_equal true
246
- @impuri.scheme_name?.must_equal true
233
+ _(impuri.has_scheme?).must_equal true
234
+ _(impuri.has_protocol?).must_equal true
235
+ _(impuri.has_scheme_name?).must_equal true
236
+ _(impuri.scheme?).must_equal true
237
+ _(impuri.protocol?).must_equal true
238
+ _(impuri.scheme_name?).must_equal true
247
239
  end
248
240
 
249
241
  it 'must return false for has_colon_path_separator?()' do
250
- @impuri.has_colon_path_separator?.must_equal false
251
- @impuri.uses_colon_path_separator?.must_equal false
242
+ _(impuri.has_colon_path_separator?).must_equal false
243
+ _(impuri.uses_colon_path_separator?).must_equal false
252
244
  end
253
245
 
254
246
  it 'must return false for has_port_number?()' do
255
- @impuri.has_port_number?.must_equal false
256
- @impuri.has_port?.must_equal false
257
- @impuri.has_portnumber?.must_equal false
258
- @impuri.port_number?.must_equal false
259
- @impuri.port?.must_equal false
260
- @impuri.portnumber?.must_equal false
247
+ _(impuri.has_port_number?).must_equal false
248
+ _(impuri.has_port?).must_equal false
249
+ _(impuri.has_portnumber?).must_equal false
250
+ _(impuri.port_number?).must_equal false
251
+ _(impuri.port?).must_equal false
252
+ _(impuri.portnumber?).must_equal false
261
253
  end
262
254
 
263
255
  it 'must return nil if there is no request URI' do
264
- @impuri.request_uri.must_be_nil
256
+ _(impuri.request_uri).must_be_nil
265
257
  end
266
258
  end # describe 'an http URI with a username'
267
259
 
268
260
  describe 'an http URI with a username and password' do
269
- before do
270
- @impuri = ImpURI.new('http://user:pass@example.com/')
271
- end
261
+ let(:impuri){ImpURI.new('http://user:pass@example.com/')}
272
262
 
273
263
  it 'must parse out the scheme' do
274
- @impuri.scheme.must_equal 'http'
275
- @impuri.protocol.must_equal 'http'
276
- @impuri.scheme_name.must_equal 'http'
264
+ _(impuri.scheme).must_equal 'http'
265
+ _(impuri.protocol).must_equal 'http'
266
+ _(impuri.scheme_name).must_equal 'http'
277
267
  end
278
268
 
279
269
  it 'must parse out the domain name' do
280
- @impuri.hostname.must_equal 'example.com'
281
- @impuri.host.must_equal 'example.com'
270
+ _(impuri.hostname).must_equal 'example.com'
271
+ _(impuri.host).must_equal 'example.com'
282
272
  end
283
273
 
284
274
  it 'must parse out the username' do
285
- @impuri.username.must_equal 'user'
286
- @impuri.user.must_equal 'user'
275
+ _(impuri.username).must_equal 'user'
276
+ _(impuri.user).must_equal 'user'
287
277
  end
288
278
 
289
279
  it 'must parse out the password' do
290
- @impuri.password.must_equal 'pass'
291
- @impuri.pass.must_equal 'pass'
292
- @impuri.passwd.must_equal 'pass'
280
+ _(impuri.password).must_equal 'pass'
281
+ _(impuri.pass).must_equal 'pass'
282
+ _(impuri.passwd).must_equal 'pass'
293
283
  end
294
284
 
295
285
  it 'must return the userinfo string' do
296
- @impuri.userinfo.must_equal 'user:pass'
297
- @impuri.credentials.must_equal 'user:pass'
298
- @impuri.username_and_password.must_equal 'user:pass'
299
- @impuri.user_info.must_equal 'user:pass'
286
+ _(impuri.userinfo).must_equal 'user:pass'
287
+ _(impuri.credentials).must_equal 'user:pass'
288
+ _(impuri.username_and_password).must_equal 'user:pass'
289
+ _(impuri.user_info).must_equal 'user:pass'
300
290
  end
301
291
 
302
292
  it 'must return nil if there are no GET request parameters' do
303
- @impuri.parameter_string.must_be_nil
304
- @impuri.parameters.must_be_nil
293
+ _(impuri.parameter_string).must_be_nil
294
+ _(impuri.parameters).must_be_nil
305
295
  end
306
296
 
307
297
  it 'must return true for has_userinfo?()' do
308
- @impuri.has_userinfo?.must_equal true
309
- @impuri.has_credentials?.must_equal true
310
- @impuri.has_username_and_password?.must_equal true
311
- @impuri.has_user_info?.must_equal true
298
+ _(impuri.has_userinfo?).must_equal true
299
+ _(impuri.has_credentials?).must_equal true
300
+ _(impuri.has_username_and_password?).must_equal true
301
+ _(impuri.has_user_info?).must_equal true
312
302
  end
313
303
 
314
304
  it 'must return true for has_scheme?()' do
315
- @impuri.has_scheme?.must_equal true
316
- @impuri.has_protocol?.must_equal true
317
- @impuri.has_scheme_name?.must_equal true
318
- @impuri.scheme?.must_equal true
319
- @impuri.protocol?.must_equal true
320
- @impuri.scheme_name?.must_equal true
305
+ _(impuri.has_scheme?).must_equal true
306
+ _(impuri.has_protocol?).must_equal true
307
+ _(impuri.has_scheme_name?).must_equal true
308
+ _(impuri.scheme?).must_equal true
309
+ _(impuri.protocol?).must_equal true
310
+ _(impuri.scheme_name?).must_equal true
321
311
  end
322
312
 
323
313
  it 'must return false for has_colon_path_separator?()' do
324
- @impuri.has_colon_path_separator?.must_equal false
325
- @impuri.uses_colon_path_separator?.must_equal false
314
+ _(impuri.has_colon_path_separator?).must_equal false
315
+ _(impuri.uses_colon_path_separator?).must_equal false
326
316
  end
327
317
 
328
318
  it 'must return false for has_port_number?()' do
329
- @impuri.has_port_number?.must_equal false
330
- @impuri.has_port?.must_equal false
331
- @impuri.has_portnumber?.must_equal false
332
- @impuri.port_number?.must_equal false
333
- @impuri.port?.must_equal false
334
- @impuri.portnumber?.must_equal false
319
+ _(impuri.has_port_number?).must_equal false
320
+ _(impuri.has_port?).must_equal false
321
+ _(impuri.has_portnumber?).must_equal false
322
+ _(impuri.port_number?).must_equal false
323
+ _(impuri.port?).must_equal false
324
+ _(impuri.portnumber?).must_equal false
335
325
  end
336
326
 
337
327
  it 'must return nil if there is no request URI' do
338
- @impuri.request_uri.must_be_nil
328
+ _(impuri.request_uri).must_be_nil
339
329
  end
340
330
  end # describe 'an http URI with a username and password'
341
331
 
342
332
  describe 'an http URI with one GET query parameter' do
343
- before do
344
- @impuri = ImpURI.new('http://example.com/?q=param')
345
- end
333
+ let(:impuri){ImpURI.new('http://example.com/?q=param')}
346
334
 
347
335
  it 'must parse out the scheme' do
348
- @impuri.scheme.must_equal 'http'
349
- @impuri.protocol.must_equal 'http'
350
- @impuri.scheme_name.must_equal 'http'
336
+ _(impuri.scheme).must_equal 'http'
337
+ _(impuri.protocol).must_equal 'http'
338
+ _(impuri.scheme_name).must_equal 'http'
351
339
  end
352
340
 
353
341
  it 'must parse out the domain name' do
354
- @impuri.hostname.must_equal 'example.com'
355
- @impuri.host.must_equal 'example.com'
342
+ _(impuri.hostname).must_equal 'example.com'
343
+ _(impuri.host).must_equal 'example.com'
356
344
  end
357
345
 
358
346
  it 'must parse out the paramter string' do
359
- @impuri.parameter_string.must_equal 'q=param'
347
+ _(impuri.parameter_string).must_equal 'q=param'
360
348
  end
361
349
 
362
350
  it 'must parse out the parameter as a hash' do
363
- @impuri.parameters.must_equal({'q' => 'param'})
351
+ _(impuri.parameters).must_equal({'q' => 'param'})
364
352
  end
365
353
 
366
354
  it 'must return false for has_userinfo?()' do
367
- @impuri.has_userinfo?.must_equal false
368
- @impuri.has_credentials?.must_equal false
369
- @impuri.has_username_and_password?.must_equal false
370
- @impuri.has_user_info?.must_equal false
355
+ _(impuri.has_userinfo?).must_equal false
356
+ _(impuri.has_credentials?).must_equal false
357
+ _(impuri.has_username_and_password?).must_equal false
358
+ _(impuri.has_user_info?).must_equal false
371
359
  end
372
360
 
373
361
  it 'must return true for has_scheme?()' do
374
- @impuri.has_scheme?.must_equal true
375
- @impuri.has_protocol?.must_equal true
376
- @impuri.has_scheme_name?.must_equal true
377
- @impuri.scheme?.must_equal true
378
- @impuri.protocol?.must_equal true
379
- @impuri.scheme_name?.must_equal true
362
+ _(impuri.has_scheme?).must_equal true
363
+ _(impuri.has_protocol?).must_equal true
364
+ _(impuri.has_scheme_name?).must_equal true
365
+ _(impuri.scheme?).must_equal true
366
+ _(impuri.protocol?).must_equal true
367
+ _(impuri.scheme_name?).must_equal true
380
368
  end
381
369
 
382
370
  it 'must return false for has_colon_path_separator?()' do
383
- @impuri.has_colon_path_separator?.must_equal false
384
- @impuri.uses_colon_path_separator?.must_equal false
371
+ _(impuri.has_colon_path_separator?).must_equal false
372
+ _(impuri.uses_colon_path_separator?).must_equal false
385
373
  end
386
374
 
387
375
  it 'must return false for has_port_number?()' do
388
- @impuri.has_port_number?.must_equal false
389
- @impuri.has_port?.must_equal false
390
- @impuri.has_portnumber?.must_equal false
391
- @impuri.port_number?.must_equal false
392
- @impuri.port?.must_equal false
393
- @impuri.portnumber?.must_equal false
376
+ _(impuri.has_port_number?).must_equal false
377
+ _(impuri.has_port?).must_equal false
378
+ _(impuri.has_portnumber?).must_equal false
379
+ _(impuri.port_number?).must_equal false
380
+ _(impuri.port?).must_equal false
381
+ _(impuri.portnumber?).must_equal false
394
382
  end
395
383
 
396
384
  it 'must return the request URI' do
397
- @impuri.request_uri.must_equal '/?q=param'
385
+ _(impuri.request_uri).must_equal '/?q=param'
398
386
  end
399
387
  end # describe 'an http URI with one GET query parameter'
400
388
 
401
389
  describe 'an http URI with two GET query parameters' do
402
- before do
403
- @impuri = ImpURI.new('http://example.com/?q=param1&r=param2')
404
- end
390
+ let(:impuri){ImpURI.new('http://example.com/?q=param1&r=param2')}
405
391
 
406
392
  it 'must parse out the scheme' do
407
- @impuri.scheme.must_equal 'http'
408
- @impuri.protocol.must_equal 'http'
409
- @impuri.scheme_name.must_equal 'http'
393
+ _(impuri.scheme).must_equal 'http'
394
+ _(impuri.protocol).must_equal 'http'
395
+ _(impuri.scheme_name).must_equal 'http'
410
396
  end
411
397
 
412
398
  it 'must parse out the domain name' do
413
- @impuri.hostname.must_equal 'example.com'
414
- @impuri.host.must_equal 'example.com'
399
+ _(impuri.hostname).must_equal 'example.com'
400
+ _(impuri.host).must_equal 'example.com'
415
401
  end
416
402
 
417
403
  it 'must parse out the paramter string' do
418
- @impuri.parameter_string.must_equal 'q=param1&r=param2'
404
+ _(impuri.parameter_string).must_equal 'q=param1&r=param2'
419
405
  end
420
406
 
421
407
  it 'must parse out the parameter as a hash' do
422
- @impuri.parameters.must_equal({'q' => 'param1', 'r' => 'param2'})
408
+ _(impuri.parameters).must_equal({'q' => 'param1', 'r' => 'param2'})
423
409
  end
424
410
 
425
411
  it 'must return false for has_userinfo?()' do
426
- @impuri.has_userinfo?.must_equal false
427
- @impuri.has_credentials?.must_equal false
428
- @impuri.has_username_and_password?.must_equal false
429
- @impuri.has_user_info?.must_equal false
412
+ _(impuri.has_userinfo?).must_equal false
413
+ _(impuri.has_credentials?).must_equal false
414
+ _(impuri.has_username_and_password?).must_equal false
415
+ _(impuri.has_user_info?).must_equal false
430
416
  end
431
417
 
432
418
  it 'must return true for has_scheme?()' do
433
- @impuri.has_scheme?.must_equal true
434
- @impuri.has_protocol?.must_equal true
435
- @impuri.has_scheme_name?.must_equal true
436
- @impuri.scheme?.must_equal true
437
- @impuri.protocol?.must_equal true
438
- @impuri.scheme_name?.must_equal true
419
+ _(impuri.has_scheme?).must_equal true
420
+ _(impuri.has_protocol?).must_equal true
421
+ _(impuri.has_scheme_name?).must_equal true
422
+ _(impuri.scheme?).must_equal true
423
+ _(impuri.protocol?).must_equal true
424
+ _(impuri.scheme_name?).must_equal true
439
425
  end
440
426
 
441
427
  it 'must return false for has_colon_path_separator?()' do
442
- @impuri.has_colon_path_separator?.must_equal false
443
- @impuri.uses_colon_path_separator?.must_equal false
428
+ _(impuri.has_colon_path_separator?).must_equal false
429
+ _(impuri.uses_colon_path_separator?).must_equal false
444
430
  end
445
431
 
446
432
  it 'must return false for has_port_number?()' do
447
- @impuri.has_port_number?.must_equal false
448
- @impuri.has_port?.must_equal false
449
- @impuri.has_portnumber?.must_equal false
450
- @impuri.port_number?.must_equal false
451
- @impuri.port?.must_equal false
452
- @impuri.portnumber?.must_equal false
433
+ _(impuri.has_port_number?).must_equal false
434
+ _(impuri.has_port?).must_equal false
435
+ _(impuri.has_portnumber?).must_equal false
436
+ _(impuri.port_number?).must_equal false
437
+ _(impuri.port?).must_equal false
438
+ _(impuri.portnumber?).must_equal false
453
439
  end
454
440
 
455
441
  it 'must return the request URI' do
456
- @impuri.request_uri.must_equal '/?q=param1&r=param2'
442
+ _(impuri.request_uri).must_equal '/?q=param1&r=param2'
457
443
  end
458
444
  end # describe 'an http URI with two GET query parameters'
459
445
 
460
446
  describe 'an http URI with two GET query parameters separated by a semicolon' do
461
- before do
462
- @impuri = ImpURI.new('http://example.com/?q=param1;r=param2')
463
- end
447
+ let(:impuri){ImpURI.new('http://example.com/?q=param1;r=param2')}
464
448
 
465
449
  it 'must parse out the scheme' do
466
- @impuri.scheme.must_equal 'http'
467
- @impuri.protocol.must_equal 'http'
468
- @impuri.scheme_name.must_equal 'http'
450
+ _(impuri.scheme).must_equal 'http'
451
+ _(impuri.protocol).must_equal 'http'
452
+ _(impuri.scheme_name).must_equal 'http'
469
453
  end
470
454
 
471
455
  it 'must parse out the domain name' do
472
- @impuri.hostname.must_equal 'example.com'
473
- @impuri.host.must_equal 'example.com'
456
+ _(impuri.hostname).must_equal 'example.com'
457
+ _(impuri.host).must_equal 'example.com'
474
458
  end
475
459
 
476
460
  it 'must parse out the paramter string' do
477
- @impuri.parameter_string.must_equal 'q=param1;r=param2'
461
+ _(impuri.parameter_string).must_equal 'q=param1;r=param2'
478
462
  end
479
463
 
480
464
  it 'must parse out the parameter as a hash' do
481
- @impuri.parameters.must_equal({'q' => 'param1', 'r' => 'param2'})
465
+ _(impuri.parameters).must_equal({'q' => 'param1', 'r' => 'param2'})
482
466
  end
483
467
 
484
468
  it 'must return false for has_userinfo?()' do
485
- @impuri.has_userinfo?.must_equal false
486
- @impuri.has_credentials?.must_equal false
487
- @impuri.has_username_and_password?.must_equal false
488
- @impuri.has_user_info?.must_equal false
469
+ _(impuri.has_userinfo?).must_equal false
470
+ _(impuri.has_credentials?).must_equal false
471
+ _(impuri.has_username_and_password?).must_equal false
472
+ _(impuri.has_user_info?).must_equal false
489
473
  end
490
474
 
491
475
  it 'must return true for has_scheme?()' do
492
- @impuri.has_scheme?.must_equal true
493
- @impuri.has_protocol?.must_equal true
494
- @impuri.has_scheme_name?.must_equal true
495
- @impuri.scheme?.must_equal true
496
- @impuri.protocol?.must_equal true
497
- @impuri.scheme_name?.must_equal true
476
+ _(impuri.has_scheme?).must_equal true
477
+ _(impuri.has_protocol?).must_equal true
478
+ _(impuri.has_scheme_name?).must_equal true
479
+ _(impuri.scheme?).must_equal true
480
+ _(impuri.protocol?).must_equal true
481
+ _(impuri.scheme_name?).must_equal true
498
482
  end
499
483
 
500
484
  it 'must return false for has_colon_path_separator?()' do
501
- @impuri.has_colon_path_separator?.must_equal false
502
- @impuri.uses_colon_path_separator?.must_equal false
485
+ _(impuri.has_colon_path_separator?).must_equal false
486
+ _(impuri.uses_colon_path_separator?).must_equal false
503
487
  end
504
488
 
505
489
  it 'must return false for has_port_number?()' do
506
- @impuri.has_port_number?.must_equal false
507
- @impuri.has_port?.must_equal false
508
- @impuri.has_portnumber?.must_equal false
509
- @impuri.port_number?.must_equal false
510
- @impuri.port?.must_equal false
511
- @impuri.portnumber?.must_equal false
490
+ _(impuri.has_port_number?).must_equal false
491
+ _(impuri.has_port?).must_equal false
492
+ _(impuri.has_portnumber?).must_equal false
493
+ _(impuri.port_number?).must_equal false
494
+ _(impuri.port?).must_equal false
495
+ _(impuri.portnumber?).must_equal false
512
496
  end
513
497
 
514
498
  it 'must return the request URI' do
515
- @impuri.request_uri.must_equal '/?q=param1;r=param2'
499
+ _(impuri.request_uri).must_equal '/?q=param1;r=param2'
516
500
  end
517
501
  end # describe 'an http URI with two GET query parameters separated by a semicolon'
518
502
 
519
503
  describe 'an http URI with the lot' do
520
- before do
521
- @impuri = ImpURI.new('http://user:pass@example.com:8080/path/to/resource?q=param1&r=param2')
522
- end
504
+ let(:impuri){ImpURI.new('http://user:pass@example.com:8080/path/to/resource?q=param1&r=param2')}
523
505
 
524
506
  it 'must parse out the scheme' do
525
- @impuri.scheme.must_equal 'http'
526
- @impuri.protocol.must_equal 'http'
527
- @impuri.scheme_name.must_equal 'http'
507
+ _(impuri.scheme).must_equal 'http'
508
+ _(impuri.protocol).must_equal 'http'
509
+ _(impuri.scheme_name).must_equal 'http'
528
510
  end
529
511
 
530
512
  it 'must parse out the domain name' do
531
- @impuri.hostname.must_equal 'example.com'
532
- @impuri.host.must_equal 'example.com'
513
+ _(impuri.hostname).must_equal 'example.com'
514
+ _(impuri.host).must_equal 'example.com'
533
515
  end
534
516
 
535
517
  it 'must parse out the path' do
536
- @impuri.path.must_equal '/path/to/resource'
518
+ _(impuri.path).must_equal '/path/to/resource'
537
519
  end
538
520
 
539
521
  it 'must parse out the port number' do
540
- @impuri.port.must_equal '8080'
541
- @impuri.port_number.must_equal '8080'
542
- @impuri.port_number.must_equal '8080'
522
+ _(impuri.port).must_equal '8080'
523
+ _(impuri.port_number).must_equal '8080'
524
+ _(impuri.port_number).must_equal '8080'
543
525
  end
544
526
 
545
527
  it 'must parse out the username' do
546
- @impuri.username.must_equal 'user'
547
- @impuri.user.must_equal 'user'
528
+ _(impuri.username).must_equal 'user'
529
+ _(impuri.user).must_equal 'user'
548
530
  end
549
531
 
550
532
  it 'must parse out the password' do
551
- @impuri.password.must_equal 'pass'
552
- @impuri.pass.must_equal 'pass'
553
- @impuri.passwd.must_equal 'pass'
533
+ _(impuri.password).must_equal 'pass'
534
+ _(impuri.pass).must_equal 'pass'
535
+ _(impuri.passwd).must_equal 'pass'
554
536
  end
555
537
 
556
538
  it 'must return the userinfo string' do
557
- @impuri.userinfo.must_equal 'user:pass'
558
- @impuri.credentials.must_equal 'user:pass'
559
- @impuri.username_and_password.must_equal 'user:pass'
560
- @impuri.user_info.must_equal 'user:pass'
539
+ _(impuri.userinfo).must_equal 'user:pass'
540
+ _(impuri.credentials).must_equal 'user:pass'
541
+ _(impuri.username_and_password).must_equal 'user:pass'
542
+ _(impuri.user_info).must_equal 'user:pass'
561
543
  end
562
544
 
563
545
  it 'must parse out the paramter string' do
564
- @impuri.parameter_string.must_equal 'q=param1&r=param2'
546
+ _(impuri.parameter_string).must_equal 'q=param1&r=param2'
565
547
  end
566
548
 
567
549
  it 'must parse out the parameter as a hash' do
568
- @impuri.parameters.must_equal({'q' => 'param1', 'r' => 'param2'})
550
+ _(impuri.parameters).must_equal({'q' => 'param1', 'r' => 'param2'})
569
551
  end
570
552
 
571
553
  it 'must return true for has_userinfo?()' do
572
- @impuri.has_userinfo?.must_equal true
573
- @impuri.has_credentials?.must_equal true
574
- @impuri.has_username_and_password?.must_equal true
575
- @impuri.has_user_info?.must_equal true
554
+ _(impuri.has_userinfo?).must_equal true
555
+ _(impuri.has_credentials?).must_equal true
556
+ _(impuri.has_username_and_password?).must_equal true
557
+ _(impuri.has_user_info?).must_equal true
576
558
  end
577
559
 
578
560
  it 'must return true for has_scheme?()' do
579
- @impuri.has_scheme?.must_equal true
580
- @impuri.has_protocol?.must_equal true
581
- @impuri.has_scheme_name?.must_equal true
582
- @impuri.scheme?.must_equal true
583
- @impuri.protocol?.must_equal true
584
- @impuri.scheme_name?.must_equal true
561
+ _(impuri.has_scheme?).must_equal true
562
+ _(impuri.has_protocol?).must_equal true
563
+ _(impuri.has_scheme_name?).must_equal true
564
+ _(impuri.scheme?).must_equal true
565
+ _(impuri.protocol?).must_equal true
566
+ _(impuri.scheme_name?).must_equal true
585
567
  end
586
568
 
587
569
  it 'must return false for has_colon_path_separator?()' do
588
- @impuri.has_colon_path_separator?.must_equal false
589
- @impuri.uses_colon_path_separator?.must_equal false
570
+ _(impuri.has_colon_path_separator?).must_equal false
571
+ _(impuri.uses_colon_path_separator?).must_equal false
590
572
  end
591
573
 
592
574
  it 'must return true for has_port_number?()' do
593
- @impuri.has_port_number?.must_equal true
594
- @impuri.has_port?.must_equal true
595
- @impuri.has_portnumber?.must_equal true
596
- @impuri.port_number?.must_equal true
597
- @impuri.port?.must_equal true
598
- @impuri.portnumber?.must_equal true
575
+ _(impuri.has_port_number?).must_equal true
576
+ _(impuri.has_port?).must_equal true
577
+ _(impuri.has_portnumber?).must_equal true
578
+ _(impuri.port_number?).must_equal true
579
+ _(impuri.port?).must_equal true
580
+ _(impuri.portnumber?).must_equal true
599
581
  end
600
582
 
601
583
  it 'must return the request URI' do
602
- @impuri.request_uri.must_equal '/path/to/resource?q=param1&r=param2'
584
+ _(impuri.request_uri).must_equal '/path/to/resource?q=param1&r=param2'
603
585
  end
604
586
  end # describe 'an http URI with the lot'
605
587
 
606
588
  describe 'an http URI with the lot and a semicolon path separator' do
607
- before do
608
- @impuri = ImpURI.new('http://user:pass@example.com:8080/path/to/resource?q=param1;r=param2')
609
- end
589
+ let(:impuri){ImpURI.new('http://user:pass@example.com:8080/path/to/resource?q=param1;r=param2')}
610
590
 
611
591
  it 'must parse out the scheme' do
612
- @impuri.scheme.must_equal 'http'
613
- @impuri.protocol.must_equal 'http'
614
- @impuri.scheme_name.must_equal 'http'
592
+ _(impuri.scheme).must_equal 'http'
593
+ _(impuri.protocol).must_equal 'http'
594
+ _(impuri.scheme_name).must_equal 'http'
615
595
  end
616
596
 
617
597
  it 'must parse out the domain name' do
618
- @impuri.hostname.must_equal 'example.com'
619
- @impuri.host.must_equal 'example.com'
598
+ _(impuri.hostname).must_equal 'example.com'
599
+ _(impuri.host).must_equal 'example.com'
620
600
  end
621
601
 
622
602
  it 'must parse out the path' do
623
- @impuri.path.must_equal '/path/to/resource'
603
+ _(impuri.path).must_equal '/path/to/resource'
624
604
  end
625
605
 
626
606
  it 'must parse out the port number' do
627
- @impuri.port.must_equal '8080'
628
- @impuri.port_number.must_equal '8080'
629
- @impuri.port_number.must_equal '8080'
607
+ _(impuri.port).must_equal '8080'
608
+ _(impuri.port_number).must_equal '8080'
609
+ _(impuri.port_number).must_equal '8080'
630
610
  end
631
611
 
632
612
  it 'must parse out the username' do
633
- @impuri.username.must_equal 'user'
634
- @impuri.user.must_equal 'user'
613
+ _(impuri.username).must_equal 'user'
614
+ _(impuri.user).must_equal 'user'
635
615
  end
636
616
 
637
617
  it 'must parse out the password' do
638
- @impuri.password.must_equal 'pass'
639
- @impuri.pass.must_equal 'pass'
640
- @impuri.passwd.must_equal 'pass'
618
+ _(impuri.password).must_equal 'pass'
619
+ _(impuri.pass).must_equal 'pass'
620
+ _(impuri.passwd).must_equal 'pass'
641
621
  end
642
622
 
643
623
  it 'must return the userinfo string' do
644
- @impuri.userinfo.must_equal 'user:pass'
645
- @impuri.credentials.must_equal 'user:pass'
646
- @impuri.username_and_password.must_equal 'user:pass'
647
- @impuri.user_info.must_equal 'user:pass'
624
+ _(impuri.userinfo).must_equal 'user:pass'
625
+ _(impuri.credentials).must_equal 'user:pass'
626
+ _(impuri.username_and_password).must_equal 'user:pass'
627
+ _(impuri.user_info).must_equal 'user:pass'
648
628
  end
649
629
 
650
630
  it 'must parse out the paramter string' do
651
- @impuri.parameter_string.must_equal 'q=param1;r=param2'
631
+ _(impuri.parameter_string).must_equal 'q=param1;r=param2'
652
632
  end
653
633
 
654
634
  it 'must parse out the parameter as a hash' do
655
- @impuri.parameters.must_equal({'q' => 'param1', 'r' => 'param2'})
635
+ _(impuri.parameters).must_equal({'q' => 'param1', 'r' => 'param2'})
656
636
  end
657
637
 
658
638
  it 'must return true for has_userinfo?()' do
659
- @impuri.has_userinfo?.must_equal true
660
- @impuri.has_credentials?.must_equal true
661
- @impuri.has_username_and_password?.must_equal true
662
- @impuri.has_user_info?.must_equal true
639
+ _(impuri.has_userinfo?).must_equal true
640
+ _(impuri.has_credentials?).must_equal true
641
+ _(impuri.has_username_and_password?).must_equal true
642
+ _(impuri.has_user_info?).must_equal true
663
643
  end
664
644
 
665
645
  it 'must return true for has_scheme?()' do
666
- @impuri.has_scheme?.must_equal true
667
- @impuri.has_protocol?.must_equal true
668
- @impuri.has_scheme_name?.must_equal true
669
- @impuri.scheme?.must_equal true
670
- @impuri.protocol?.must_equal true
671
- @impuri.scheme_name?.must_equal true
646
+ _(impuri.has_scheme?).must_equal true
647
+ _(impuri.has_protocol?).must_equal true
648
+ _(impuri.has_scheme_name?).must_equal true
649
+ _(impuri.scheme?).must_equal true
650
+ _(impuri.protocol?).must_equal true
651
+ _(impuri.scheme_name?).must_equal true
672
652
  end
673
653
 
674
654
  it 'must return false for has_colon_path_separator?()' do
675
- @impuri.has_colon_path_separator?.must_equal false
676
- @impuri.uses_colon_path_separator?.must_equal false
655
+ _(impuri.has_colon_path_separator?).must_equal false
656
+ _(impuri.uses_colon_path_separator?).must_equal false
677
657
  end
678
658
 
679
659
  it 'must return true for has_port_number?()' do
680
- @impuri.has_port_number?.must_equal true
681
- @impuri.has_port?.must_equal true
682
- @impuri.has_portnumber?.must_equal true
683
- @impuri.port_number?.must_equal true
684
- @impuri.port?.must_equal true
685
- @impuri.portnumber?.must_equal true
660
+ _(impuri.has_port_number?).must_equal true
661
+ _(impuri.has_port?).must_equal true
662
+ _(impuri.has_portnumber?).must_equal true
663
+ _(impuri.port_number?).must_equal true
664
+ _(impuri.port?).must_equal true
665
+ _(impuri.portnumber?).must_equal true
686
666
  end
687
667
 
688
668
  it 'must return the request URI' do
689
- @impuri.request_uri.must_equal '/path/to/resource?q=param1;r=param2'
669
+ _(impuri.request_uri).must_equal '/path/to/resource?q=param1;r=param2'
690
670
  end
691
671
  end # describe 'an http URI with the lot and a semicolon path separator'
692
672
 
693
673
  describe 'an ssh identifier' do
694
- before do
695
- @impuri = ImpURI.new('username@example.com:~account')
696
- end
674
+ let(:impuri){ImpURI.new('username@example.com:~account')}
697
675
 
698
676
  it 'must return a username' do
699
- @impuri.username.must_equal 'username'
677
+ _(impuri.username).must_equal 'username'
700
678
  end
701
679
 
702
680
  it 'must return true for is_ssh?()' do
703
- @impuri.is_ssh?.must_equal true
681
+ _(impuri.is_ssh?).must_equal true
704
682
  end
705
683
 
706
684
  it 'must correctly determine if it has user info' do
707
- @impuri.credentials?.must_equal false
708
- @impuri.username_and_password?.must_equal false
709
- @impuri.user_info?.must_equal false
710
- @impuri.userinfo?.must_equal false
711
- @impuri.has_credentials?.must_equal false
712
- @impuri.has_username_and_password?.must_equal false
713
- @impuri.has_user_info?.must_equal false
714
- @impuri.has_userinfo?.must_equal false
685
+ _(impuri.credentials?).must_equal false
686
+ _(impuri.username_and_password?).must_equal false
687
+ _(impuri.user_info?).must_equal false
688
+ _(impuri.userinfo?).must_equal false
689
+ _(impuri.has_credentials?).must_equal false
690
+ _(impuri.has_username_and_password?).must_equal false
691
+ _(impuri.has_user_info?).must_equal false
692
+ _(impuri.has_userinfo?).must_equal false
715
693
  end
716
694
 
717
695
  it 'must correctly determine if it has a colon path separator' do
718
- @impuri.colon_path_separator?.must_equal true
719
- @impuri.has_colon_path_separator?.must_equal true
720
- @impuri.uses_colon_path_separator?.must_equal true
696
+ _(impuri.colon_path_separator?).must_equal true
697
+ _(impuri.has_colon_path_separator?).must_equal true
698
+ _(impuri.uses_colon_path_separator?).must_equal true
721
699
  end
722
700
 
723
701
  it 'must correctly determine if it has a scheme' do
724
- @impuri.protocol?.must_equal false
725
- @impuri.scheme_name?.must_equal false
726
- @impuri.scheme?.must_equal false
727
- @impuri.has_protocol?.must_equal false
728
- @impuri.has_scheme_name?.must_equal false
729
- @impuri.has_scheme?.must_equal false
702
+ _(impuri.protocol?).must_equal false
703
+ _(impuri.scheme_name?).must_equal false
704
+ _(impuri.scheme?).must_equal false
705
+ _(impuri.has_protocol?).must_equal false
706
+ _(impuri.has_scheme_name?).must_equal false
707
+ _(impuri.has_scheme?).must_equal false
730
708
  end
731
709
 
732
710
  it 'must correctly determine if it has a port number' do
733
- @impuri.has_port_number?.must_equal false
734
- @impuri.has_port?.must_equal false
735
- @impuri.has_portnumber?.must_equal false
736
- @impuri.port_number?.must_equal false
737
- @impuri.port?.must_equal false
738
- @impuri.portnumber?.must_equal false
711
+ _(impuri.has_port_number?).must_equal false
712
+ _(impuri.has_port?).must_equal false
713
+ _(impuri.has_portnumber?).must_equal false
714
+ _(impuri.port_number?).must_equal false
715
+ _(impuri.port?).must_equal false
716
+ _(impuri.portnumber?).must_equal false
739
717
  end
740
718
 
741
719
  it 'must return hostname_and_path when requested' do
742
- @impuri.hostname_and_path.must_equal 'example.com:~account'
720
+ _(impuri.hostname_and_path).must_equal 'example.com:~account'
743
721
  end
744
722
 
745
723
  it 'must return hostname_and_port_number when requested' do
746
- @impuri.hostname_and_port_number.must_equal 'example.com'
724
+ _(impuri.hostname_and_port_number).must_equal 'example.com'
747
725
  end
748
726
 
749
727
  it 'must return a hostname' do
750
- @impuri.hostname.must_equal 'example.com'
728
+ _(impuri.hostname).must_equal 'example.com'
751
729
  end
752
730
 
753
731
  it 'must return a path' do
754
- @impuri.path.must_equal '~account'
732
+ _(impuri.path).must_equal '~account'
755
733
  end
756
734
  end # describe 'an ssh identifier'
757
735
 
758
736
  describe 'an ssh identifier as per Github' do
759
- before do
760
- @impuri = ImpURI.new('git@github.com:thoran/ImpURI.git')
761
- end
737
+ let(:impuri){ImpURI.new('git@github.com:thoran/ImpURI.git')}
762
738
 
763
739
  it 'must return a username' do
764
- @impuri.username.must_equal 'git'
740
+ _(impuri.username).must_equal 'git'
765
741
  end
766
742
 
767
743
  it 'must return true for is_ssh?()' do
768
- @impuri.is_ssh?.must_equal true
744
+ _(impuri.is_ssh?).must_equal true
769
745
  end
770
746
 
771
747
  it 'must correctly determine if it has user info' do
772
- @impuri.credentials?.must_equal false
773
- @impuri.username_and_password?.must_equal false
774
- @impuri.user_info?.must_equal false
775
- @impuri.userinfo?.must_equal false
776
- @impuri.has_credentials?.must_equal false
777
- @impuri.has_username_and_password?.must_equal false
778
- @impuri.has_user_info?.must_equal false
779
- @impuri.has_userinfo?.must_equal false
748
+ _(impuri.credentials?).must_equal false
749
+ _(impuri.username_and_password?).must_equal false
750
+ _(impuri.user_info?).must_equal false
751
+ _(impuri.userinfo?).must_equal false
752
+ _(impuri.has_credentials?).must_equal false
753
+ _(impuri.has_username_and_password?).must_equal false
754
+ _(impuri.has_user_info?).must_equal false
755
+ _(impuri.has_userinfo?).must_equal false
780
756
  end
781
757
 
782
758
  it 'must correctly determine if it has a colon path separator' do
783
- @impuri.colon_path_separator?.must_equal true
784
- @impuri.has_colon_path_separator?.must_equal true
785
- @impuri.uses_colon_path_separator?.must_equal true
759
+ _(impuri.colon_path_separator?).must_equal true
760
+ _(impuri.has_colon_path_separator?).must_equal true
761
+ _(impuri.uses_colon_path_separator?).must_equal true
786
762
  end
787
763
 
788
764
  it 'must correctly determine if it has a scheme' do
789
- @impuri.protocol?.must_equal false
790
- @impuri.scheme_name?.must_equal false
791
- @impuri.scheme?.must_equal false
792
- @impuri.has_protocol?.must_equal false
793
- @impuri.has_scheme_name?.must_equal false
794
- @impuri.has_scheme?.must_equal false
765
+ _(impuri.protocol?).must_equal false
766
+ _(impuri.scheme_name?).must_equal false
767
+ _(impuri.scheme?).must_equal false
768
+ _(impuri.has_protocol?).must_equal false
769
+ _(impuri.has_scheme_name?).must_equal false
770
+ _(impuri.has_scheme?).must_equal false
795
771
  end
796
772
 
797
773
  it 'must correctly determine if it has a port number' do
798
- @impuri.has_port_number?.must_equal false
799
- @impuri.has_port?.must_equal false
800
- @impuri.has_portnumber?.must_equal false
801
- @impuri.port_number?.must_equal false
802
- @impuri.port?.must_equal false
803
- @impuri.portnumber?.must_equal false
774
+ _(impuri.has_port_number?).must_equal false
775
+ _(impuri.has_port?).must_equal false
776
+ _(impuri.has_portnumber?).must_equal false
777
+ _(impuri.port_number?).must_equal false
778
+ _(impuri.port?).must_equal false
779
+ _(impuri.portnumber?).must_equal false
804
780
  end
805
781
 
806
782
  it 'must return hostname_and_path when requested' do
807
- @impuri.hostname_and_path.must_equal 'github.com:thoran/ImpURI.git'
783
+ _(impuri.hostname_and_path).must_equal 'github.com:thoran/ImpURI.git'
808
784
  end
809
785
 
810
786
  it 'must return hostname_and_port_number when requested' do
811
- @impuri.hostname_and_port_number.must_equal 'github.com'
787
+ _(impuri.hostname_and_port_number).must_equal 'github.com'
812
788
  end
813
789
 
814
790
  it 'must return a hostname' do
815
- @impuri.hostname.must_equal 'github.com'
791
+ _(impuri.hostname).must_equal 'github.com'
816
792
  end
817
793
 
818
794
  it 'must return a path' do
819
- @impuri.path.must_equal 'thoran/ImpURI.git'
795
+ _(impuri.path).must_equal 'thoran/ImpURI.git'
820
796
  end
821
797
  end # describe 'an ssh identifier as per Github'
822
798
 
@@ -825,78 +801,76 @@ describe ImpURI do
825
801
  describe 'attribute writers' do
826
802
 
827
803
  describe 'a very simple http URI' do
828
- before do
829
- @impuri = ImpURI.new('http://example.com')
830
- end
804
+ let(:impuri){ImpURI.new('http://example.com')}
831
805
 
832
806
  it 'must assign the scheme' do
833
- @impuri.scheme = 'ftp'
834
- @impuri.scheme.must_equal 'ftp'
807
+ impuri.scheme = 'ftp'
808
+ _(impuri.scheme).must_equal 'ftp'
835
809
  end
836
810
 
837
811
  it 'must assign the username' do
838
- @impuri.username = 'user'
839
- @impuri.username.must_equal 'user'
812
+ impuri.username = 'user'
813
+ _(impuri.username).must_equal 'user'
840
814
  end
841
815
 
842
816
  it 'must assign the password' do
843
- @impuri.password = 'pass'
844
- @impuri.password.must_equal 'pass'
817
+ impuri.password = 'pass'
818
+ _(impuri.password).must_equal 'pass'
845
819
  end
846
820
 
847
821
  it 'must assign the hostname' do
848
- @impuri.hostname = 'example2.com'
849
- @impuri.hostname.must_equal 'example2.com'
822
+ impuri.hostname = 'example2.com'
823
+ _(impuri.hostname).must_equal 'example2.com'
850
824
  end
851
825
 
852
826
  it 'must assign the port number' do
853
- @impuri.port_number = '8080'
854
- @impuri.port_number.must_equal '8080'
827
+ impuri.port_number = '8080'
828
+ _(impuri.port_number).must_equal '8080'
855
829
  end
856
830
 
857
831
  it 'must assign the path' do
858
- @impuri.path = '/path/to/here'
859
- @impuri.path.must_equal '/path/to/here'
832
+ impuri.path = '/path/to/here'
833
+ _(impuri.path).must_equal '/path/to/here'
860
834
  end
861
835
 
862
836
  it 'must assign the parameter string' do
863
- @impuri.path = '/'
864
- @impuri.parameter_string = 'a=1&b=2'
865
- @impuri.parameter_string.must_equal 'a=1&b=2'
837
+ impuri.path = '/'
838
+ impuri.parameter_string = 'a=1&b=2'
839
+ _(impuri.parameter_string).must_equal 'a=1&b=2'
866
840
  end
867
841
 
868
842
  it 'must assign the parameter string and cause the parameters to be assigned also' do
869
- @impuri.path = '/'
870
- @impuri.parameter_string = 'a=1&b=2'
871
- @impuri.parameters.must_equal({'a' => '1', 'b' => '2'})
843
+ impuri.path = '/'
844
+ impuri.parameter_string = 'a=1&b=2'
845
+ _(impuri.parameters).must_equal({'a' => '1', 'b' => '2'})
872
846
  end
873
847
 
874
848
  it 'must assign the parameters and cause the parameter_sting to be assigned also' do
875
- @impuri.path = '/'
876
- @impuri.parameters = {'a' => '1', 'b' => '2'}
877
- @impuri.parameter_string.must_equal 'a=1&b=2'
849
+ impuri.path = '/'
850
+ impuri.parameters = {'a' => '1', 'b' => '2'}
851
+ _(impuri.parameter_string).must_equal 'a=1&b=2'
878
852
  end
879
853
 
880
854
  it 'must return true for has_userinfo?() after setting username and password' do
881
- @impuri.username = 'user'
882
- @impuri.password = 'pass'
883
- @impuri.has_userinfo?.must_equal true
855
+ impuri.username = 'user'
856
+ impuri.password = 'pass'
857
+ _(impuri.has_userinfo?).must_equal true
884
858
  end
885
859
 
886
860
  it 'must return true for has_port_number?() after setting the port number' do
887
- @impuri.port_number = '8080'
888
- @impuri.has_port_number?.must_equal true
861
+ impuri.port_number = '8080'
862
+ _(impuri.has_port_number?).must_equal true
889
863
  end
890
864
 
891
865
  it 'must return a URI string with all attributes which have been set' do
892
- @impuri.scheme = 'ftp'
893
- @impuri.username = 'user'
894
- @impuri.password = 'pass'
895
- @impuri.hostname = 'example2.com'
896
- @impuri.port_number = '8080'
897
- @impuri.path = '/path/to/here'
898
- @impuri.parameter_string = 'a=1&b=2'
899
- @impuri.to_s.must_equal 'ftp://user:pass@example2.com:8080/path/to/here?a=1&b=2'
866
+ impuri.scheme = 'ftp'
867
+ impuri.username = 'user'
868
+ impuri.password = 'pass'
869
+ impuri.hostname = 'example2.com'
870
+ impuri.port_number = '8080'
871
+ impuri.path = '/path/to/here'
872
+ impuri.parameter_string = 'a=1&b=2'
873
+ _(impuri.to_s).must_equal 'ftp://user:pass@example2.com:8080/path/to/here?a=1&b=2'
900
874
  end
901
875
  end # describe 'a very simple http URI'
902
876