summary refs log tree commit
path: root/test/spec_body_proxy.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/spec_body_proxy.rb')
-rw-r--r--test/spec_body_proxy.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/spec_body_proxy.rb b/test/spec_body_proxy.rb
index c65e10d2..8b6e6a5e 100644
--- a/test/spec_body_proxy.rb
+++ b/test/spec_body_proxy.rb
@@ -1,5 +1,6 @@
 require 'rack/body_proxy'
 require 'stringio'
+require 'ostruct'
 
 describe Rack::BodyProxy do
   should 'call each on the wrapped body' do
@@ -49,6 +50,21 @@ describe Rack::BodyProxy do
     called.should.equal true
   end
 
+  should 'allow multiple arguments in respond_to?' do
+    body  = []
+    proxy = Rack::BodyProxy.new(body) { }
+    proc { proxy.respond_to?(:foo, false) }.should.not.raise
+  end
+
+  should 'not respond to :to_ary' do
+    body = OpenStruct.new(:to_ary => true)
+    body.respond_to?(:to_ary).should.equal true
+
+    proxy = Rack::BodyProxy.new(body) { }
+    proxy.respond_to?(:to_ary).should.equal false
+    proxy.respond_to?("to_ary").should.equal false
+  end
+
   should 'not close more than one time' do
     count = 0
     proxy = Rack::BodyProxy.new([]) { count += 1; raise "Block invoked more than 1 time!" if count > 1 }