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