mirror of
https://github.com/samsonjs/http-cookie.git
synced 2026-03-25 08:55:53 +00:00
Add a test for <=>.
This commit is contained in:
parent
7554bffb32
commit
ea4759bd27
1 changed files with 15 additions and 0 deletions
|
|
@ -418,6 +418,21 @@ class TestHTTPCookie < Test::Unit::TestCase
|
|||
}.merge(options)
|
||||
end
|
||||
|
||||
def test_compare
|
||||
time = Time.now
|
||||
cookies = [
|
||||
{ :created_at => time + 1 },
|
||||
{ :created_at => time - 1 },
|
||||
{ :created_at => time },
|
||||
{ :created_at => time, :path => '/foo/bar/' },
|
||||
{ :created_at => time, :path => '/foo/' },
|
||||
].map { |attrs| HTTP::Cookie.new(cookie_values(attrs)) }
|
||||
|
||||
assert_equal([3, 4, 1, 2, 0], cookies.sort.map { |i|
|
||||
cookies.find_index { |j| j.equal?(i) }
|
||||
})
|
||||
end
|
||||
|
||||
def test_new_rejects_cookies_that_do_not_contain_an_embedded_dot
|
||||
url = URI 'http://rubyforge.org/'
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue