class SecureCookiesTest

Constants

DEFAULT

Public Instance Methods

assert_cookies(*expected) click to toggle source
# File actionpack/test/dispatch/ssl_test.rb, line 167
def assert_cookies(*expected)
  assert_equal expected, response.headers["Set-Cookie"].split("\n")
end
get(**options) click to toggle source
Calls superclass method TestHelpers::Rack#get
# File actionpack/test/dispatch/ssl_test.rb, line 162
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
# File actionpack/test/dispatch/ssl_test.rb, line 206
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
# File actionpack/test/dispatch/ssl_test.rb, line 171
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
# File actionpack/test/dispatch/ssl_test.rb, line 176
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
# File actionpack/test/dispatch/ssl_test.rb, line 196
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
# File actionpack/test/dispatch/ssl_test.rb, line 191
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
# File actionpack/test/dispatch/ssl_test.rb, line 201
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
# File actionpack/test/dispatch/ssl_test.rb, line 186
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
# File actionpack/test/dispatch/ssl_test.rb, line 181
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_keeps_original_headers_behavior() click to toggle source
# File actionpack/test/dispatch/ssl_test.rb, line 216
def test_keeps_original_headers_behavior
  get headers: { "Connection" => %w[close] }
  assert_equal "close", response.headers["Connection"]
end
test_no_cookies() click to toggle source
# File actionpack/test/dispatch/ssl_test.rb, line 211
def test_no_cookies
  get
  assert_nil response.headers["Set-Cookie"]
end