glebtv-httpclient 3.2.7 → 3.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/.travis.yml +2 -2
- data/Gemfile +0 -9
- data/Gemfile.lock +34 -258
- data/README.md +1 -0
- data/httpclient.gemspec +1 -2
- data/lib/httpclient/auth.rb +241 -157
- data/lib/httpclient/cacert.p7s +3865 -1911
- data/lib/httpclient/lru_cache.rb +27 -24
- data/lib/httpclient/ssl_config.rb +3 -2
- data/lib/httpclient/version.rb +2 -1
- data/spec/basic_spec.rb +82 -82
- data/spec/cookie_spec.rb +132 -132
- data/spec/hexdump_spec.rb +1 -1
- data/spec/http_message_spec.rb +37 -37
- data/spec/httpclient_spec.rb +267 -263
- data/spec/keepalive_spec.rb +5 -5
- data/spec/lru_spec.rb +5 -11
- data/test/test_auth.rb +29 -2
- metadata +2 -30
data/spec/cookie_spec.rb
CHANGED
@@ -9,111 +9,111 @@ describe 'Cookies' do
|
|
9
9
|
@c = WebAgent::Cookie.new()
|
10
10
|
end
|
11
11
|
|
12
|
-
it { @c.
|
12
|
+
it { expect(@c).to be_an_instance_of WebAgent::Cookie }
|
13
13
|
|
14
14
|
it '#discard' do
|
15
|
-
(!!@c.discard?).
|
15
|
+
expect(!!@c.discard?).to be_falsey
|
16
16
|
@c.discard = true
|
17
|
-
(!!@c.discard?).
|
17
|
+
expect(!!@c.discard?).to be_truthy
|
18
18
|
end
|
19
19
|
|
20
20
|
it '#match?' do
|
21
21
|
url = urify('http://www.rubycolor.org/hoge/funi/#919191')
|
22
22
|
|
23
23
|
@c.domain = 'www.rubycolor.org'
|
24
|
-
@c.match?(url).
|
24
|
+
expect(@c.match?(url)).to be_truthy
|
25
25
|
|
26
26
|
@c.domain = '.rubycolor.org'
|
27
|
-
@c.match?(url).
|
27
|
+
expect(@c.match?(url)).to be_truthy
|
28
28
|
|
29
29
|
@c.domain = 'aaa.www.rubycolor.org'
|
30
|
-
@c.match?(url).
|
30
|
+
expect(@c.match?(url)).to be_falsey
|
31
31
|
|
32
32
|
@c.domain = 'aaa.www.rubycolor.org'
|
33
|
-
@c.match?(url).
|
33
|
+
expect(@c.match?(url)).to be_falsey
|
34
34
|
|
35
35
|
@c.domain = 'www.rubycolor.org'
|
36
36
|
@c.path = '/'
|
37
|
-
@c.match?(url).
|
37
|
+
expect(@c.match?(url)).to be_truthy
|
38
38
|
|
39
39
|
@c.domain = 'www.rubycolor.org'
|
40
40
|
@c.path = '/hoge'
|
41
|
-
@c.match?(url).
|
41
|
+
expect(@c.match?(url)).to be_truthy
|
42
42
|
|
43
43
|
@c.domain = 'www.rubycolor.org'
|
44
44
|
@c.path = '/hoge/hoge'
|
45
|
-
@c.match?(url).
|
45
|
+
expect(@c.match?(url)).to be_falsey
|
46
46
|
|
47
47
|
@c.domain = 'www.rubycolor.org'
|
48
48
|
@c.path = '/hoge'
|
49
49
|
@c.secure = true
|
50
|
-
@c.match?(url).
|
50
|
+
expect(@c.match?(url)).to be_falsey
|
51
51
|
|
52
52
|
url2 = urify('https://www.rubycolor.org/hoge/funi/#919191')
|
53
53
|
@c.domain = 'www.rubycolor.org'
|
54
54
|
@c.path = '/hoge'
|
55
55
|
@c.secure = true
|
56
|
-
@c.match?(url2).
|
56
|
+
expect(@c.match?(url2)).to be_truthy
|
57
57
|
|
58
58
|
@c.domain = 'www.rubycolor.org'
|
59
59
|
@c.path = '/hoge'
|
60
60
|
@c.secure = nil
|
61
|
-
@c.match?(url2).
|
61
|
+
expect(@c.match?(url2)).to be_truthy
|
62
62
|
|
63
63
|
url.port = 80
|
64
64
|
@c.domain = 'www.rubycolor.org'
|
65
65
|
@c.path = '/hoge'
|
66
|
-
@c.match?(url).
|
66
|
+
expect(@c.match?(url)).to be_truthy
|
67
67
|
|
68
68
|
url_nopath = URI.parse('http://www.rubycolor.org')
|
69
69
|
@c.domain = 'www.rubycolor.org'
|
70
70
|
@c.path = '/'
|
71
|
-
@c.match?(url_nopath).
|
71
|
+
expect(@c.match?(url_nopath)).to be_truthy
|
72
72
|
end
|
73
73
|
|
74
74
|
it '#head_match?' do
|
75
|
-
@c.head_match?("","").
|
76
|
-
@c.head_match?("a","").
|
77
|
-
@c.head_match?("","a").
|
78
|
-
@c.head_match?("abcde","abcde").
|
79
|
-
@c.head_match?("abcde","abcdef").
|
80
|
-
@c.head_match?("abcdef","abcde").
|
81
|
-
@c.head_match?("abcde","bcde").
|
82
|
-
@c.head_match?("bcde","abcde").
|
75
|
+
expect(@c.head_match?("","")).to be_truthy
|
76
|
+
expect(@c.head_match?("a","")).to be_falsey
|
77
|
+
expect(@c.head_match?("","a")).to be_truthy
|
78
|
+
expect(@c.head_match?("abcde","abcde")).to be_truthy
|
79
|
+
expect(@c.head_match?("abcde","abcdef")).to be_truthy
|
80
|
+
expect(@c.head_match?("abcdef","abcde")).to be_falsey
|
81
|
+
expect(@c.head_match?("abcde","bcde")).to be_falsey
|
82
|
+
expect(@c.head_match?("bcde","abcde")).to be_falsey
|
83
83
|
end
|
84
84
|
|
85
85
|
it 'tail_match?' do
|
86
|
-
@c.tail_match?("","").
|
87
|
-
@c.tail_match?("a","").
|
88
|
-
@c.tail_match?("","a").
|
89
|
-
@c.tail_match?("abcde","abcde").
|
90
|
-
@c.tail_match?("abcde","abcdef").
|
91
|
-
@c.tail_match?("abcdef","abcde").
|
92
|
-
@c.tail_match?("abcde","bcde").
|
93
|
-
@c.tail_match?("bcde","abcde").
|
86
|
+
expect(@c.tail_match?("","")).to be_truthy
|
87
|
+
expect(@c.tail_match?("a","")).to be_falsey
|
88
|
+
expect(@c.tail_match?("","a")).to be_truthy
|
89
|
+
expect(@c.tail_match?("abcde","abcde")).to be_truthy
|
90
|
+
expect(@c.tail_match?("abcde","abcdef")).to be_falsey
|
91
|
+
expect(@c.tail_match?("abcdef","abcde")).to be_falsey
|
92
|
+
expect(@c.tail_match?("abcde","bcde")).to be_falsey
|
93
|
+
expect(@c.tail_match?("bcde","abcde")).to be_truthy
|
94
94
|
end
|
95
95
|
|
96
96
|
|
97
97
|
it 'domain_match' do
|
98
98
|
extend WebAgent::CookieUtils
|
99
|
-
(!!domain_match("hoge.co.jp",".")).
|
100
|
-
(!!domain_match("192.168.10.1","192.168.10.1")).
|
101
|
-
(!!domain_match("192.168.10.1","192.168.10.2")).
|
102
|
-
(!!domain_match("hoge.co.jp",".hoge.co.jp")).
|
103
|
-
(!!domain_match("www.hoge.co.jp", "www.hoge.co.jp")).
|
104
|
-
(!!domain_match("www.hoge.co.jp", "www2.hoge.co.jp")).
|
105
|
-
(!!domain_match("www.hoge.co.jp", ".hoge.co.jp")).
|
106
|
-
(!!domain_match("www.aa.hoge.co.jp", ".hoge.co.jp")).
|
107
|
-
(!!domain_match("www.hoge.co.jp", "hoge.co.jp")).
|
99
|
+
expect(!!domain_match("hoge.co.jp",".")).to be_truthy
|
100
|
+
expect(!!domain_match("192.168.10.1","192.168.10.1")).to be_truthy
|
101
|
+
expect(!!domain_match("192.168.10.1","192.168.10.2")).to be_falsey
|
102
|
+
expect(!!domain_match("hoge.co.jp",".hoge.co.jp")).to be_truthy
|
103
|
+
expect(!!domain_match("www.hoge.co.jp", "www.hoge.co.jp")).to be_truthy
|
104
|
+
expect(!!domain_match("www.hoge.co.jp", "www2.hoge.co.jp")).to be_falsey
|
105
|
+
expect(!!domain_match("www.hoge.co.jp", ".hoge.co.jp")).to be_truthy
|
106
|
+
expect(!!domain_match("www.aa.hoge.co.jp", ".hoge.co.jp")).to be_truthy
|
107
|
+
expect(!!domain_match("www.hoge.co.jp", "hoge.co.jp")).to be_falsey
|
108
108
|
end
|
109
109
|
|
110
110
|
it 'join_quotedstr' do
|
111
111
|
arr1 = ['hoge=funi', 'hoge2=funi2']
|
112
|
-
arr1.
|
112
|
+
expect(arr1).to eq @c.instance_eval{join_quotedstr(arr1,';')}
|
113
113
|
arr2 = ['hoge="fu', 'ni"', 'funi=funi']
|
114
|
-
['hoge="fu;ni"','funi=funi'].
|
114
|
+
expect(['hoge="fu;ni"','funi=funi']).to eq @c.instance_eval{join_quotedstr(arr2,';')}
|
115
115
|
arr3 = ['hoge="funi";hoge2="fu','ni2";hoge3="hoge"', 'funi="funi"']
|
116
|
-
['hoge="funi";hoge2="fu,ni2";hoge3="hoge"', 'funi="funi"'].
|
116
|
+
expect(['hoge="funi";hoge2="fu,ni2";hoge3="hoge"', 'funi="funi"']).to eq @c.instance_eval{join_quotedstr(arr3,',')}
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
@@ -127,52 +127,52 @@ describe 'CookieManager' do
|
|
127
127
|
str = "inkid=n92b0ADOgACIgUb9lsjHqAAAHu2a; expires=Wed, 01-Dec-2010 00:00:00 GMT; path=/"
|
128
128
|
@cm.parse(str, urify('http://www.test.jp'))
|
129
129
|
cookie = @cm.cookies[0]
|
130
|
-
cookie.
|
131
|
-
cookie.name.
|
132
|
-
cookie.value.
|
133
|
-
cookie.expires.
|
134
|
-
cookie.path.
|
130
|
+
expect(cookie).to be_an_instance_of WebAgent::Cookie
|
131
|
+
expect(cookie.name).to eq "inkid"
|
132
|
+
expect(cookie.value).to eq "n92b0ADOgACIgUb9lsjHqAAAHu2a"
|
133
|
+
expect(cookie.expires).to eq Time.gm(2010, 12, 1, 0,0,0)
|
134
|
+
expect(cookie.path).to eq "/"
|
135
135
|
end
|
136
136
|
|
137
137
|
it 'parse2' do
|
138
138
|
str = "xmen=off,0,0,1; path=/; domain=.excite.co.jp; expires=Wednesday, 31-Dec-2037 12:00:00 GMT"
|
139
139
|
@cm.parse(str, urify('http://www.excite.co.jp'))
|
140
140
|
cookie = @cm.cookies[0]
|
141
|
-
cookie.
|
142
|
-
cookie.name.
|
143
|
-
cookie.value.
|
144
|
-
cookie.domain.
|
145
|
-
cookie.expires.
|
146
|
-
cookie.path.
|
147
|
-
|
148
|
-
cookie.secure
|
149
|
-
cookie.http_only
|
141
|
+
expect(cookie).to be_an_instance_of WebAgent::Cookie
|
142
|
+
expect(cookie.name).to eq "xmen"
|
143
|
+
expect(cookie.value).to eq "off,0,0,1"
|
144
|
+
expect(cookie.domain).to eq ".excite.co.jp"
|
145
|
+
expect(cookie.expires).to eq Time.gm(2037,12,31,12,0,0)
|
146
|
+
expect(cookie.path).to eq "/"
|
147
|
+
|
148
|
+
expect(cookie.secure?).to be_falsey
|
149
|
+
expect(cookie.http_only?).to be_falsey
|
150
150
|
end
|
151
151
|
|
152
152
|
it 'parse3' do
|
153
153
|
str = "xmen=off,0,0,1; path=/; domain=.excite.co.jp; expires=Wednesday, 31-Dec-2037 12:00:00 GMT;Secure;HTTPOnly"
|
154
154
|
@cm.parse(str, urify('http://www.excite.co.jp'))
|
155
155
|
cookie = @cm.cookies[0]
|
156
|
-
cookie.
|
157
|
-
cookie.name.
|
158
|
-
cookie.value.
|
159
|
-
cookie.domain.
|
160
|
-
cookie.expires.
|
161
|
-
cookie.path.
|
162
|
-
cookie.secure
|
163
|
-
cookie.http_only
|
156
|
+
expect(cookie).to be_an_instance_of WebAgent::Cookie
|
157
|
+
expect(cookie.name).to eq "xmen"
|
158
|
+
expect(cookie.value).to eq "off,0,0,1"
|
159
|
+
expect(cookie.domain).to eq ".excite.co.jp"
|
160
|
+
expect(cookie.expires).to eq Time.gm(2037,12,31,12,0,0)
|
161
|
+
expect(cookie.path).to eq "/"
|
162
|
+
expect(cookie.secure?).to be_truthy
|
163
|
+
expect(cookie.http_only?).to be_truthy
|
164
164
|
end
|
165
165
|
|
166
166
|
it 'parse_double_semicolon' do
|
167
167
|
str = "xmen=off,0,0,1;; path=\"/;;\"; domain=.excite.co.jp; expires=Wednesday, 31-Dec-2037 12:00:00 GMT"
|
168
168
|
@cm.parse(str, urify('http://www.excite.co.jp'))
|
169
169
|
cookie = @cm.cookies[0]
|
170
|
-
cookie.
|
171
|
-
cookie.name.
|
172
|
-
cookie.value.
|
173
|
-
cookie.domain.
|
174
|
-
cookie.expires.
|
175
|
-
cookie.path.
|
170
|
+
expect(cookie).to be_an_instance_of WebAgent::Cookie
|
171
|
+
expect(cookie.name).to eq "xmen"
|
172
|
+
expect(cookie.value).to eq "off,0,0,1"
|
173
|
+
expect(cookie.domain).to eq ".excite.co.jp"
|
174
|
+
expect(cookie.expires).to eq Time.gm(2037,12,31,12,0,0)
|
175
|
+
expect(cookie.path).to eq "/;;"
|
176
176
|
end
|
177
177
|
|
178
178
|
it 'check_expired_cookies' do
|
@@ -188,58 +188,58 @@ describe 'CookieManager' do
|
|
188
188
|
@cm.cookies = cookies
|
189
189
|
@cm.check_expired_cookies()
|
190
190
|
# expires == nil cookies (session cookie) exists.
|
191
|
-
@cm.cookies.
|
191
|
+
expect(@cm.cookies).to eq [c2,c4]
|
192
192
|
end
|
193
193
|
|
194
194
|
it 'parse_expires' do
|
195
195
|
str = "inkid=n92b0ADOgACIgUb9lsjHqAAAHu2a; expires=; path=/"
|
196
196
|
@cm.parse(str, urify('http://www.test.jp'))
|
197
197
|
cookie = @cm.cookies[0]
|
198
|
-
cookie.
|
199
|
-
cookie.name.
|
200
|
-
cookie.value.
|
201
|
-
cookie.expires.
|
202
|
-
cookie.path.
|
198
|
+
expect(cookie).to be_an_instance_of WebAgent::Cookie
|
199
|
+
expect(cookie.name).to eq "inkid"
|
200
|
+
expect(cookie.value).to eq "n92b0ADOgACIgUb9lsjHqAAAHu2a"
|
201
|
+
expect(cookie.expires).to be_nil
|
202
|
+
expect(cookie.path).to eq "/"
|
203
203
|
|
204
204
|
str = "inkid=n92b0ADOgACIgUb9lsjHqAAAHu2a; path=/; expires="
|
205
205
|
@cm.parse(str, urify('http://www.test.jp'))
|
206
206
|
cookie = @cm.cookies[0]
|
207
|
-
cookie.
|
208
|
-
cookie.name.
|
209
|
-
cookie.value.
|
210
|
-
cookie.expires.
|
211
|
-
cookie.path.
|
207
|
+
expect(cookie).to be_an_instance_of WebAgent::Cookie
|
208
|
+
expect(cookie.name).to eq "inkid"
|
209
|
+
expect(cookie.value).to eq "n92b0ADOgACIgUb9lsjHqAAAHu2a"
|
210
|
+
expect(cookie.expires).to be_nil
|
211
|
+
expect(cookie.path).to eq "/"
|
212
212
|
|
213
213
|
str = "inkid=n92b0ADOgACIgUb9lsjHqAAAHu2a; path=/; expires=\"\""
|
214
214
|
@cm.parse(str, urify('http://www.test.jp'))
|
215
215
|
cookie = @cm.cookies[0]
|
216
|
-
cookie.
|
217
|
-
cookie.name.
|
218
|
-
cookie.value.
|
219
|
-
cookie.expires.
|
220
|
-
cookie.path.
|
216
|
+
expect(cookie).to be_an_instance_of WebAgent::Cookie
|
217
|
+
expect(cookie.name).to eq "inkid"
|
218
|
+
expect(cookie.value).to eq "n92b0ADOgACIgUb9lsjHqAAAHu2a"
|
219
|
+
expect(cookie.expires).to be_nil
|
220
|
+
expect(cookie.path).to eq "/"
|
221
221
|
end
|
222
222
|
|
223
223
|
it 'parse_after_expiration' do
|
224
224
|
str = "inkid=n92b0ADOgACIgUb9lsjHqAAAHu2a; expires=Wed, 01-Dec-2010 00:00:00 GMT; path=/"
|
225
225
|
@cm.parse(str, urify('http://www.test.jp'))
|
226
226
|
cookie = @cm.cookies[0]
|
227
|
-
cookie.
|
228
|
-
cookie.name.
|
229
|
-
cookie.value.
|
230
|
-
cookie.expires.
|
231
|
-
cookie.path.
|
227
|
+
expect(cookie).to be_an_instance_of WebAgent::Cookie
|
228
|
+
expect(cookie.name).to eq "inkid"
|
229
|
+
expect(cookie.value).to eq "n92b0ADOgACIgUb9lsjHqAAAHu2a"
|
230
|
+
expect(cookie.expires).to eq Time.gm(2010, 12, 1, 0,0,0)
|
231
|
+
expect(cookie.path).to eq "/"
|
232
232
|
|
233
233
|
time = Time.now.utc.round + 60
|
234
234
|
expires = time.strftime("%a, %d-%b-%Y %H:%M:%S GMT")
|
235
235
|
str = "inkid=n92b0ADOgACIgUb9lsjHqAAAHu2a; expires=#{expires}; path=/"
|
236
236
|
@cm.parse(str, urify('http://www.test.jp'))
|
237
237
|
cookie = @cm.cookies[0]
|
238
|
-
cookie.
|
239
|
-
cookie.name.
|
240
|
-
cookie.value.
|
241
|
-
cookie.expires.
|
242
|
-
cookie.path.
|
238
|
+
expect(cookie).to be_an_instance_of WebAgent::Cookie
|
239
|
+
expect(cookie.name).to eq "inkid"
|
240
|
+
expect(cookie.value).to eq "n92b0ADOgACIgUb9lsjHqAAAHu2a"
|
241
|
+
expect(cookie.expires).to eq time
|
242
|
+
expect(cookie.path).to eq "/"
|
243
243
|
end
|
244
244
|
|
245
245
|
it 'find_cookie' do
|
@@ -254,7 +254,7 @@ describe 'CookieManager' do
|
|
254
254
|
|
255
255
|
url = urify('http://www.excite.co.jp/hoge/funi/')
|
256
256
|
cookie_str = @cm.find(url)
|
257
|
-
cookie_str.
|
257
|
+
expect(cookie_str).to eq "xmen=off,0,0,2"
|
258
258
|
end
|
259
259
|
|
260
260
|
it 'load_cookies' do
|
@@ -271,24 +271,24 @@ EOF
|
|
271
271
|
@cm.cookies_file = 'tmp_test.tmp'
|
272
272
|
@cm.load_cookies()
|
273
273
|
c0, c1, c2, c3 = @cm.cookies
|
274
|
-
c0.url.to_s.
|
275
|
-
c0.name.
|
276
|
-
c0.value.
|
277
|
-
c0.expires.
|
278
|
-
c0.domain.
|
279
|
-
c0.path.
|
280
|
-
c0.flag.
|
281
|
-
|
282
|
-
c1.url.to_s.
|
283
|
-
c1.name.
|
284
|
-
c1.value.
|
285
|
-
c1.expires.
|
286
|
-
c1.domain.
|
287
|
-
c1.path.
|
288
|
-
c1.flag.
|
274
|
+
expect(c0.url.to_s).to eq 'http://www.zdnet.co.jp/news/0106/08/e_gibson.html'
|
275
|
+
expect(c0.name).to eq 'NGUserID'
|
276
|
+
expect(c0.value).to eq 'd29b8f49-10875-992421294-1'
|
277
|
+
expect(c0.expires).to eq Time.at(2145801600)
|
278
|
+
expect(c0.domain).to eq 'www.zdnet.co.jp'
|
279
|
+
expect(c0.path).to eq '/'
|
280
|
+
expect(c0.flag).to eq 9
|
281
|
+
|
282
|
+
expect(c1.url.to_s).to eq 'http://www.zdnet.co.jp/news/0106/08/e_gibson.html'
|
283
|
+
expect(c1.name).to eq 'PACK'
|
284
|
+
expect(c1.value).to eq 'zd3-992421294-7436'
|
285
|
+
expect(c1.expires).to eq Time.at(1293839999)
|
286
|
+
expect(c1.domain).to eq '.zdnet.co.jp'
|
287
|
+
expect(c1.path).to eq '/'
|
288
|
+
expect(c1.flag).to eq 13
|
289
289
|
#
|
290
|
-
c2.expires.
|
291
|
-
c3.expires.
|
290
|
+
expect(c2.expires).to be_nil
|
291
|
+
expect(c3.expires).to be_nil
|
292
292
|
ensure
|
293
293
|
File.unlink("tmp_test.tmp")
|
294
294
|
end
|
@@ -312,14 +312,14 @@ EOF
|
|
312
312
|
File.open("tmp_test2.tmp","r") {|f|
|
313
313
|
str2 = f.read()
|
314
314
|
}
|
315
|
-
str.
|
315
|
+
expect(str).to eq str2
|
316
316
|
#
|
317
|
-
File.exist?('tmp_test2.tmp').
|
317
|
+
expect(File.exist?('tmp_test2.tmp')).to be_truthy
|
318
318
|
File.unlink("tmp_test2.tmp")
|
319
319
|
@cm.save_cookies()
|
320
|
-
File.exist?('tmp_test2.tmp').
|
320
|
+
expect(File.exist?('tmp_test2.tmp')).to be_falsey
|
321
321
|
@cm.save_cookies(true)
|
322
|
-
File.exist?('tmp_test2.tmp').
|
322
|
+
expect(File.exist?('tmp_test2.tmp')).to be_truthy
|
323
323
|
ensure
|
324
324
|
File.unlink("tmp_test.tmp")
|
325
325
|
if FileTest.exist?("tmp_test2.tmp")
|
@@ -339,7 +339,7 @@ EOF
|
|
339
339
|
@cm.parse("quxx=5; path=/; expires=#{(Time.now - 10).asctime}", uri)
|
340
340
|
@cm.save_cookies()
|
341
341
|
@cm.load_cookies
|
342
|
-
@cm.cookies.size.
|
342
|
+
expect(@cm.cookies.size).to eq 1
|
343
343
|
ensure
|
344
344
|
File.unlink("tmp_test.tmp") if File.exist?("tmp_test.tmp")
|
345
345
|
end
|
@@ -352,9 +352,9 @@ EOF
|
|
352
352
|
c.url = urify("http://www.inac.co.jp/hoge")
|
353
353
|
@cm.add(c)
|
354
354
|
c = @cm.cookies[0]
|
355
|
-
c.name.
|
356
|
-
c.value.
|
357
|
-
c.expires.
|
355
|
+
expect(c.name).to eq 'hoge'
|
356
|
+
expect(c.value).to eq 'funi'
|
357
|
+
expect(c.expires).to be_nil
|
358
358
|
end
|
359
359
|
|
360
360
|
it 'add2' do
|
@@ -373,26 +373,26 @@ EOF
|
|
373
373
|
@cm.add(c)
|
374
374
|
#
|
375
375
|
c1, c2 = @cm.cookies
|
376
|
-
c1.path.
|
377
|
-
c2.path.
|
376
|
+
expect(c1.path).to eq ''
|
377
|
+
expect(c2.path).to eq '/hoge/hoge2'
|
378
378
|
end
|
379
379
|
|
380
380
|
it 'test_check_cookie_accept_domain' do
|
381
381
|
@cm.accept_domains = [".example1.co.jp", "www1.example.jp"]
|
382
382
|
@cm.reject_domains = [".example2.co.jp", "www2.example.jp"]
|
383
383
|
check1 = @cm.check_cookie_accept_domain("www.example1.co.jp")
|
384
|
-
check1.
|
384
|
+
expect(check1).to be_truthy
|
385
385
|
check2 = @cm.check_cookie_accept_domain("www.example2.co.jp")
|
386
|
-
check2.
|
386
|
+
expect(check2).to be_falsey
|
387
387
|
check3 = @cm.check_cookie_accept_domain("www1.example.jp")
|
388
|
-
check3.
|
388
|
+
expect(check3).to be_truthy
|
389
389
|
check4 = @cm.check_cookie_accept_domain("www2.example.jp")
|
390
|
-
check4.
|
390
|
+
expect(check4).to be_falsey
|
391
391
|
check5 = @cm.check_cookie_accept_domain("aa.www2.example.jp")
|
392
|
-
check5.
|
392
|
+
expect(check5).to be_truthy
|
393
393
|
check6 = @cm.check_cookie_accept_domain("aa.www2.example.jp")
|
394
|
-
check6.
|
395
|
-
@cm.check_cookie_accept_domain(nil).
|
394
|
+
expect(check6).to be_truthy
|
395
|
+
expect(@cm.check_cookie_accept_domain(nil)).to be_falsey
|
396
396
|
end
|
397
397
|
|
398
398
|
end
|
data/spec/hexdump_spec.rb
CHANGED
@@ -6,6 +6,6 @@ describe 'HexDump' do
|
|
6
6
|
it 'encode' do
|
7
7
|
str = "\032l\277\370\2429\216\236\351[{\{\262\350\274\376"
|
8
8
|
str.force_encoding('BINARY') if str.respond_to?(:force_encoding)
|
9
|
-
HexDump.encode(str).
|
9
|
+
expect(HexDump.encode(str)).to eq ["00000000 1a6cbff8 a2398e9e e95b7b7b b2e8bcfe .l...9...[{{...."]
|
10
10
|
end
|
11
11
|
end
|