mirror of
https://github.com/samsonjs/http-cookie.git
synced 2026-03-29 09:35:52 +00:00
Fix <=> so that two cookies of different values are not equal.
This commit is contained in:
parent
ea4759bd27
commit
9d842404e3
2 changed files with 7 additions and 1 deletions
|
|
@ -379,7 +379,8 @@ class HTTP::Cookie
|
|||
# Precedence: 1. longer path 2. older creation
|
||||
(@name <=> other.name).nonzero? ||
|
||||
(other.path.length <=> @path.length).nonzero? ||
|
||||
@created_at <=> other.created_at
|
||||
(@created_at <=> other.created_at).nonzero? ||
|
||||
@value <=> other.value
|
||||
end
|
||||
include Comparable
|
||||
|
||||
|
|
|
|||
|
|
@ -433,6 +433,11 @@ class TestHTTPCookie < Test::Unit::TestCase
|
|||
})
|
||||
end
|
||||
|
||||
def test_equal
|
||||
assert_not_equal(HTTP::Cookie.new(cookie_values),
|
||||
HTTP::Cookie.new(cookie_values(:value => 'bar')))
|
||||
end
|
||||
|
||||
def test_new_rejects_cookies_that_do_not_contain_an_embedded_dot
|
||||
url = URI 'http://rubyforge.org/'
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue