summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/rack/body_proxy.rb5
-rw-r--r--lib/rack/response.rb3
-rw-r--r--test/spec_body_proxy.rb4
-rw-r--r--test/spec_response.rb4
4 files changed, 5 insertions, 11 deletions
diff --git a/lib/rack/body_proxy.rb b/lib/rack/body_proxy.rb
index 15e4a84f..cb161980 100644
--- a/lib/rack/body_proxy.rb
+++ b/lib/rack/body_proxy.rb
@@ -9,10 +9,6 @@ module Rack
end
def respond_to?(method_name, include_all = false)
- case method_name
- when :to_ary, 'to_ary'
- return false
- end
super or @body.respond_to?(method_name, include_all)
end
@@ -39,7 +35,6 @@ module Rack
end
def method_missing(method_name, *args, &block)
- super if :to_ary == method_name
@body.__send__(method_name, *args, &block)
end
end
diff --git a/lib/rack/response.rb b/lib/rack/response.rb
index 58f9e5d6..f39848cc 100644
--- a/lib/rack/response.rb
+++ b/lib/rack/response.rb
@@ -72,11 +72,10 @@ module Rack
close
[status.to_i, header, []]
else
- [status.to_i, header, BodyProxy.new(self){}]
+ [status.to_i, header, self]
end
end
alias to_a finish # For *response
- alias to_ary finish # For implicit-splat on Ruby 1.9.2
def each(&callback)
@body.each(&callback)
diff --git a/test/spec_body_proxy.rb b/test/spec_body_proxy.rb
index 6be79f8b..d3853e1e 100644
--- a/test/spec_body_proxy.rb
+++ b/test/spec_body_proxy.rb
@@ -63,8 +63,8 @@ describe Rack::BodyProxy do
body.respond_to?(:to_ary).must_equal true
proxy = Rack::BodyProxy.new(body) { }
- proxy.respond_to?(:to_ary).must_equal false
- proxy.respond_to?("to_ary").must_equal false
+ x = [proxy]
+ assert_equal x, x.flatten
end
it 'not close more than one time' do
diff --git a/test/spec_response.rb b/test/spec_response.rb
index 3cd56664..ff7cba6f 100644
--- a/test/spec_response.rb
+++ b/test/spec_response.rb
@@ -466,8 +466,8 @@ describe Rack::Response do
it "wraps the body from #to_ary to prevent infinite loops" do
res = Rack::Response.new
- res.finish.last.wont_respond_to(:to_ary)
- lambda { res.finish.last.to_ary }.must_raise NoMethodError
+ x = res.finish
+ assert_equal x, x.flatten
end
end