about summary refs log tree commit homepage
path: root/test
diff options
context:
space:
mode:
authorzedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9>2006-05-13 21:25:53 +0000
committerzedshaw <zedshaw@19e92222-5c0b-0410-8929-a290d50e31e9>2006-05-13 21:25:53 +0000
commit429ebcd5dfbdc54c239fa9425048119026fe9bef (patch)
tree443199f961579a561f6e19c03fa7e99fec4a0fff /test
parent07dd2b47830cb6b1a2bcbc4d0b3f1b621019fb97 (diff)
downloadunicorn-429ebcd5dfbdc54c239fa9425048119026fe9bef.tar.gz
git-svn-id: svn+ssh://rubyforge.org/var/svn/mongrel/trunk@173 19e92222-5c0b-0410-8929-a290d50e31e9
Diffstat (limited to 'test')
-rw-r--r--test/test_conditional.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/test/test_conditional.rb b/test/test_conditional.rb
index cccf976..42791ba 100644
--- a/test/test_conditional.rb
+++ b/test/test_conditional.rb
@@ -15,8 +15,8 @@ class HttpParserTest < Test::Unit::TestCase
     # get the ETag and Last-Modified headers
     @path = '/README'
     res = @http.start { |http| http.get(@path) }
-    @etag = res['ETag']
-    @last_modified = res['Last-Modified']
+    assert_not_nil @etag = res['ETag']
+    assert_not_nil @last_modified = res['Last-Modified']
   end
 
   def teardown
@@ -94,7 +94,13 @@ class HttpParserTest < Test::Unit::TestCase
     # assert the response status is correct for GET and HEAD
     def assert_status_for_get_and_head(status_class, headers = {})
       %w{ get head }.each do |method|
-        assert_kind_of status_class, @http.send(method, @path, headers)
+        res = @http.send(method, @path, headers)
+        assert_kind_of status_class, res
+        assert_equal @etag, res['ETag']
+        case status_class
+          when Net::HTTPNotModified : assert_nil res['Last-Modified']
+          when Net::HTTPOK          : assert_equal @last_modified, res['Last-Modified']
+        end
       end
     end
 end