|
5 | 5 | describe '#validate_cookie' do
|
6 | 6 | localaddr = 'http://localhost/foo/bar/'
|
7 | 7 | it 'should fail if version unset' do
|
8 |
| - expect(lambda do |
| 8 | + expect { |
9 | 9 | unversioned = Cookie.from_set_cookie localaddr, 'foo=bar'
|
10 | 10 | unversioned.instance_variable_set :@version, nil
|
11 | 11 | CookieValidation.validate_cookie localaddr, unversioned
|
12 |
| - end).to raise_error InvalidCookieError |
| 12 | + }.to raise_error InvalidCookieError |
13 | 13 | end
|
14 | 14 | it 'should fail if the path is more specific' do
|
15 |
| - expect(lambda do |
| 15 | + expect { |
16 | 16 | Cookie.from_set_cookie localaddr, 'foo=bar;path=/foo/bar/baz'
|
17 |
| - end).to raise_error InvalidCookieError |
| 17 | + }.to raise_error InvalidCookieError |
18 | 18 | end
|
19 | 19 | it 'should fail if the path is different than the request' do
|
20 |
| - expect(lambda do |
| 20 | + expect { |
21 | 21 | Cookie.from_set_cookie localaddr, 'foo=bar;path=/baz/'
|
22 |
| - end).to raise_error InvalidCookieError |
| 22 | + }.to raise_error InvalidCookieError |
23 | 23 | end
|
24 | 24 | it 'should fail if the domain has no dots' do
|
25 |
| - expect(lambda do |
| 25 | + expect { |
26 | 26 | Cookie.from_set_cookie 'http://zero/', 'foo=bar;domain=zero'
|
27 |
| - end).to raise_error InvalidCookieError |
| 27 | + }.to raise_error InvalidCookieError |
28 | 28 | end
|
29 | 29 | it 'should fail for explicit localhost' do
|
30 |
| - expect(lambda do |
| 30 | + expect { |
31 | 31 | Cookie.from_set_cookie localaddr, 'foo=bar;domain=localhost'
|
32 |
| - end).to raise_error InvalidCookieError |
| 32 | + }.to raise_error InvalidCookieError |
33 | 33 | end
|
34 | 34 | it 'should fail for mismatched domains' do
|
35 |
| - expect(lambda do |
| 35 | + expect { |
36 | 36 | Cookie.from_set_cookie 'http://www.foo.com/', 'foo=bar;domain=bar.com'
|
37 |
| - end).to raise_error InvalidCookieError |
| 37 | + }.to raise_error InvalidCookieError |
38 | 38 | end
|
39 | 39 | it 'should fail for domains more than one level up' do
|
40 |
| - expect(lambda do |
| 40 | + expect { |
41 | 41 | Cookie.from_set_cookie 'http://x.y.z.com/', 'foo=bar;domain=z.com'
|
42 |
| - end).to raise_error InvalidCookieError |
| 42 | + }.to raise_error InvalidCookieError |
43 | 43 | end
|
44 | 44 | it 'should fail for setting subdomain cookies' do
|
45 |
| - expect(lambda do |
| 45 | + expect { |
46 | 46 | Cookie.from_set_cookie 'http://foo.com/', 'foo=bar;domain=auth.foo.com'
|
47 |
| - end).to raise_error InvalidCookieError |
| 47 | + }.to raise_error InvalidCookieError |
48 | 48 | end
|
49 | 49 | it 'should handle a normal implicit internet cookie' do
|
50 | 50 | normal = Cookie.from_set_cookie 'http://foo.com/', 'foo=bar'
|
|
0 commit comments