diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-04-16 22:28:06 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-04-16 22:31:32 -0700 |
commit | 95fa512342b4495cf9d56bbf663aa2114a85a4e1 (patch) | |
tree | 49f05085be19f91c2c63d11c5fddc31d9827030d /test/unit/test_response.rb | |
parent | 9c4c5f03b5dccbbaa263a0d0eace0fca3a2d1180 (diff) | |
download | unicorn-95fa512342b4495cf9d56bbf663aa2114a85a4e1.tar.gz |
Avoid creating new string objects and then discarding them right away by stuffing non-constant but always-present headers into the initial output.
Diffstat (limited to 'test/unit/test_response.rb')
-rw-r--r-- | test/unit/test_response.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/unit/test_response.rb b/test/unit/test_response.rb index 8abc86c..1d47c57 100644 --- a/test/unit/test_response.rb +++ b/test/unit/test_response.rb @@ -60,7 +60,7 @@ class ResponseTest < Test::Unit::TestCase out = StringIO.new HttpResponse.write(out,[200, {"X-Whatever" => "stuff"}, []]) assert out.closed? - assert_match(/^Status: 200 OK\r\nX-Whatever: stuff\r\n/, out.string) + assert_equal 1, out.string.split(/\r\n/).grep(/^Status: 200 OK/i).size end # we always favor the code returned by the application, since "Status" @@ -71,7 +71,7 @@ class ResponseTest < Test::Unit::TestCase header_hash = {"X-Whatever" => "stuff", 'StaTus' => "666" } HttpResponse.write(out,[200, header_hash, []]) assert out.closed? - assert_match(/^Status: 200 OK\r\nX-Whatever: stuff\r\n/, out.string) + assert_equal 1, out.string.split(/\r\n/).grep(/^Status: 200 OK/i).size assert_equal 1, out.string.split(/\r\n/).grep(/^Status:/i).size end |