Skip to content

Commit

Permalink
Split out the test.
Browse files Browse the repository at this point in the history
  • Loading branch information
eric committed Mar 23, 2011
1 parent 81fccaa commit b7f1cea
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions test/test_ssl.rb
Expand Up @@ -9,7 +9,7 @@ class TestSSL < Test::Unit::TestCase
def default_app def default_app
lambda { |env| lambda { |env|
headers = {'Content-Type' => "text/html"} headers = {'Content-Type' => "text/html"}
headers['Set-Cookie'] = "id=1; path=/\ntoken=abc; path=/; secure; HttpOnly\ntoken=3; path=/; secure" headers['Set-Cookie'] = "id=1; path=/\ntoken=abc; path=/; secure; HttpOnly"
[200, headers, ["OK"]] [200, headers, ["OK"]]
} }
end end
Expand Down Expand Up @@ -77,7 +77,20 @@ def test_hsts_include_subdomains


def test_flag_cookies_as_secure def test_flag_cookies_as_secure
get "https://example.org/" get "https://example.org/"
assert_equal ["id=1; path=/; secure", "token=abc; path=/; secure; HttpOnly", "token=3; path=/; secure" ], assert_equal ["id=1; path=/; secure", "token=abc; path=/; secure; HttpOnly" ],
last_response.headers['Set-Cookie'].split("\n")
end

def test_flag_cookies_as_secure_at_end_of_line
default_app = lambda { |env|
headers = {'Content-Type' => "text/html",
'Set-Cookie' => "problem=def; path=/; HttpOnly; secure" }
[200, headers, ["OK"]]
}
self.app = Rack::SSL.new(default_app)

get "https://example.org/"
assert_equal ["problem=def; path=/; HttpOnly; secure" ],
last_response.headers['Set-Cookie'].split("\n") last_response.headers['Set-Cookie'].split("\n")
end end


Expand Down

0 comments on commit b7f1cea

Please sign in to comment.