Permalink
Browse files

adjust response tests for edge rack

  • Loading branch information...
1 parent 461dafa commit 7e53bee80661833d3bfd185e267f6ba69a0fca4a @rkh rkh committed Dec 12, 2012
Showing with 8 additions and 3 deletions.
  1. +8 −3 test/response_test.rb
View
@@ -5,6 +5,11 @@
class ResponseTest < Test::Unit::TestCase
setup { @response = Sinatra::Response.new }
+ def assert_same_body(a, b)
+ enum = Enumerable.const_get(:Enumerator)
+ assert_equal enum.new(a).to_a, enum.new(b).to_a
+ end
+
it "initializes with 200, text/html, and empty body" do
assert_equal 200, @response.status
assert_equal 'text/html', @response['Content-Type']
@@ -35,7 +40,7 @@ class ResponseTest < Test::Unit::TestCase
@response.body = ['Hello', 'World!', '']
status, headers, body = @response.finish
assert_equal '14', headers['Content-Length']
- assert_equal @response.body, body
+ assert_same_body @response.body, body
end
it 'does not call #to_ary or #inject on the body' do
@@ -49,11 +54,11 @@ def object.each(*) end
it 'does not nest a Sinatra::Response' do
@response.body = Sinatra::Response.new ["foo"]
- assert_equal @response.body, ["foo"]
+ assert_same_body @response.body, ["foo"]
end
it 'does not nest a Rack::Response' do
@response.body = Rack::Response.new ["foo"]
- assert_equal @response.body, ["foo"]
+ assert_same_body @response.body, ["foo"]
end
end

0 comments on commit 7e53bee

Please sign in to comment.