diff options
Diffstat (limited to 'test/unit/test_cgi_wrapper.rb')
-rw-r--r-- | test/unit/test_cgi_wrapper.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/unit/test_cgi_wrapper.rb b/test/unit/test_cgi_wrapper.rb new file mode 100644 index 0000000..a494655 --- /dev/null +++ b/test/unit/test_cgi_wrapper.rb @@ -0,0 +1,26 @@ + +require 'test/test_helper' + +class MockHttpRequest + attr_reader :body + + def params + return { 'REQUEST_METHOD' => 'GET'} + end +end + +class CGIWrapperTest < Test::Unit::TestCase + + def test_set_cookies_output_cookies + request = MockHttpRequest.new + response = nil # not needed for this test + output_headers = {} + + cgi = Mongrel::CGIWrapper.new(request, response) + session = CGI::Session.new(cgi, 'database_manager' => CGI::Session::MemoryStore) + cgi.send_cookies(output_headers) + + assert(output_headers.has_key?("Set-Cookie")) + assert_equal("_session_id="+session.session_id+"; path=", output_headers["Set-Cookie"]) + end +end
\ No newline at end of file |