mirror of
https://github.com/samsonjs/http-cookie.git
synced 2026-03-25 08:55:53 +00:00
Gain more coverage.
This commit is contained in:
parent
6ec66d11ed
commit
028b77987c
2 changed files with 16 additions and 2 deletions
|
|
@ -105,6 +105,12 @@ class TestHTTPCookie < Test::Unit::TestCase
|
|||
}.size
|
||||
end
|
||||
|
||||
def test_parse_no_name
|
||||
cookie = '=no-name; path=/'
|
||||
url = URI.parse('http://www.example.com/')
|
||||
assert_equal 0, HTTP::Cookie.parse(cookie, url).size
|
||||
end
|
||||
|
||||
def test_parse_weird_cookie
|
||||
cookie = 'n/a, ASPSESSIONIDCSRRQDQR=FBLDGHPBNDJCPCGNCPAENELB; path=/'
|
||||
url = URI.parse('http://www.searchinnovation.com/')
|
||||
|
|
@ -425,10 +431,10 @@ class TestHTTPCookie < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_set_cookie_value
|
||||
url = URI.parse('http://rubyforge.org/')
|
||||
url = URI.parse('http://rubyforge.org/path/')
|
||||
|
||||
['foo=bar', 'foo="bar"', 'foo="ba\"r baz"'].each { |cookie_value|
|
||||
cookie_params = @cookie_params.merge('secure' => 'secure', 'max-age' => 'Max-Age=1000')
|
||||
cookie_params = @cookie_params.merge('path' => '/path/', 'secure' => 'secure', 'max-age' => 'Max-Age=1000')
|
||||
date = Time.at(Time.now.to_i)
|
||||
cookie_params.keys.combine.each do |keys|
|
||||
cookie_text = [cookie_value, *keys.map { |key| cookie_params[key] }].join('; ')
|
||||
|
|
|
|||
|
|
@ -321,6 +321,14 @@ module TestHTTPCookieJar
|
|||
assert_equal(0, @jar.cookies(url).length)
|
||||
end
|
||||
|
||||
def test_save_nonexistent_saver
|
||||
Dir.mktmpdir { |dir|
|
||||
assert_raises(ArgumentError) {
|
||||
@jar.save(File.join(dir, "file"), :nonexistent)
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
def test_save_cookies_yaml
|
||||
url = URI 'http://rubyforge.org/'
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue