assert_cookies(*expected)
click to toggle source
def assert_cookies(*expected)
assert_equal expected, response.headers["Set-Cookie"].split("\n")
end
get(**options)
click to toggle source
def get(**options)
self.app = build_app(**options)
super "https://example.org"
end
test_cookies_as_not_secure_with_secure_cookies_disabled()
click to toggle source
def test_cookies_as_not_secure_with_secure_cookies_disabled
get headers: { "Set-Cookie" => DEFAULT }, ssl_options: { secure_cookies: false }
assert_cookies(*DEFAULT.split("\n"))
end
test_flag_cookies_as_secure()
click to toggle source
def test_flag_cookies_as_secure
get headers: { "Set-Cookie" => DEFAULT }
assert_cookies "id=1; path=/; secure", "token=abc; path=/; secure; HttpOnly"
end
test_flag_cookies_as_secure_at_end_of_line()
click to toggle source
def test_flag_cookies_as_secure_at_end_of_line
get headers: { "Set-Cookie" => "problem=def; path=/; HttpOnly; secure" }
assert_cookies "problem=def; path=/; HttpOnly; secure"
end
test_flag_cookies_as_secure_with_has_not_spaces_after()
click to toggle source
def test_flag_cookies_as_secure_with_has_not_spaces_after
get headers: { "Set-Cookie" => "problem=def; path=/; secure;HttpOnly" }
assert_cookies "problem=def; path=/; secure;HttpOnly"
end
test_flag_cookies_as_secure_with_has_not_spaces_before()
click to toggle source
def test_flag_cookies_as_secure_with_has_not_spaces_before
get headers: { "Set-Cookie" => "problem=def; path=/;secure; HttpOnly" }
assert_cookies "problem=def; path=/;secure; HttpOnly"
end
test_flag_cookies_as_secure_with_ignore_case()
click to toggle source
def test_flag_cookies_as_secure_with_ignore_case
get headers: { "Set-Cookie" => "problem=def; path=/; Secure; HttpOnly" }
assert_cookies "problem=def; path=/; Secure; HttpOnly"
end
test_flag_cookies_as_secure_with_more_spaces_after()
click to toggle source
def test_flag_cookies_as_secure_with_more_spaces_after
get headers: { "Set-Cookie" => "problem=def; path=/; secure; HttpOnly" }
assert_cookies "problem=def; path=/; secure; HttpOnly"
end
test_flag_cookies_as_secure_with_more_spaces_before()
click to toggle source
def test_flag_cookies_as_secure_with_more_spaces_before
get headers: { "Set-Cookie" => "problem=def; path=/; HttpOnly; secure" }
assert_cookies "problem=def; path=/; HttpOnly; secure"
end
test_no_cookies()
click to toggle source
def test_no_cookies
get
assert_nil response.headers["Set-Cookie"]
end