about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-05-11 18:54:47 -0700
committerEric Wong <normalperson@yhbt.net>2011-05-11 18:57:43 -0700
commit5979a9b113815721140058d021ecfffc5c529de4 (patch)
tree10614bcd8153da5ce4bcecbe76596190041607f1
parentbcb9fb819a8753863952302d71215152cc715935 (diff)
Could be useful for some folks.
-rw-r--r--test/test_clogger.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/test_clogger.rb b/test/test_clogger.rb
index 9440d74..35a211a 100644
--- a/test/test_clogger.rb
+++ b/test/test_clogger.rb
@@ -28,6 +28,7 @@ class TestClogger < Test::Unit::TestCase
       "QUERY_STRING" => "goodbye=true",
       "rack.errors" => $stderr,
       "rack.input" => File.open('/dev/null', 'rb'),
+      "rack.url_scheme" => "http",
       "REMOTE_ADDR" => 'home',
     }
   end
@@ -795,4 +796,16 @@ class TestClogger < Test::Unit::TestCase
     assert_equal :PONIES, s[1]
     assert_equal 2, s.size
   end
+
+  def test_full_uri
+    s = []
+    format = '"$request_method ' \
+             '$env{rack.url_scheme}://$http_host$request_uri $http_version"'
+    app = lambda { |env| [200, [], [] ] }
+    cl = Clogger.new(app, :logger => s, :format => format)
+    @req["HTTP_HOST"] = "example.com"
+    status, headers, body = cl.call(@req)
+    expect = "\"GET http://example.com/hello?goodbye=true HTTP/1.0\"\n"
+    assert_equal [ expect ], s
+  end
 end