diff options
author | zedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9> | 2006-01-28 19:34:12 +0000 |
---|---|---|
committer | zedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9> | 2006-01-28 19:34:12 +0000 |
commit | 6a5116197a687798f1dc9b533796a8319cb82c2e (patch) | |
tree | bd791521e8515b0388b658ad8a4856e5870e28e8 /test/test_response.rb | |
parent | 004dec2c2f44a0db510dfd65e5ffd8c9fc4ff83e (diff) | |
download | unicorn-6a5116197a687798f1dc9b533796a8319cb82c2e.tar.gz |
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@9 19e92222-5c0b-0410-8929-a290d50e31e9
Diffstat (limited to 'test/test_response.rb')
-rw-r--r-- | test/test_response.rb | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/test/test_response.rb b/test/test_response.rb new file mode 100644 index 0000000..f033ba6 --- /dev/null +++ b/test/test_response.rb @@ -0,0 +1,48 @@ +require 'test/unit' +require 'mongrel' + +include Mongrel + +class ResponseTest < Test::Unit::TestCase + + def test_response_headers + out = StringIO.new + resp = HttpResponse.new(out) + resp.status = 200 + resp.header["Accept"] = "text/plain" + resp.header["X-Whatever"] = "stuff" + resp.out.write("test") + resp.finished + + out.rewind + puts out.read + end + + def test_response_200 + io = StringIO.new + resp = HttpResponse.new(io) + resp.start do |head,out| + head["Accept"] = "text/plain" + out.write("tested") + out.write("hello!") + end + + io.rewind + puts io.read + end + + def test_response_404 + io = StringIO.new + + resp = HttpResponse.new(io) + resp.start(404) do |head,out| + head['Accept'] = "text/plain" + out.write("NOT FOUND") + end + + io.rewind + puts io.read + end + +end + |