You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rubygem-rack/rubygem-rack-test-object-wh...

44 lines
1.2 KiB

From 17a3e1ea7be50094d09b6f5fbb4770b5468e8421 Mon Sep 17 00:00:00 2001
From: HannesG <hag@informatik.uni-kiel.de>
Date: Thu, 29 Dec 2011 19:23:32 +0100
Subject: [PATCH] Test an object which repsonds to each instead of a set.
---
test/spec_response.rb | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/test/spec_response.rb b/test/spec_response.rb
index 07dd012..589063e 100644
--- a/test/spec_response.rb
+++ b/test/spec_response.rb
@@ -1,4 +1,3 @@
-require 'set'
require 'rack/response'
require 'stringio'
@@ -125,7 +124,6 @@ describe Rack::Response do
response = Rack::Response.new
response.redirect "/foo"
status, header, body = response.finish
-
status.should.equal 302
header["Location"].should.equal "/foo"
@@ -147,7 +145,12 @@ describe Rack::Response do
str = ""; body.each { |part| str << part }
str.should.equal "foobar"
- r = Rack::Response.new(["foo", "bar"].to_set)
+ object_with_each = Object.new
+ def object_with_each.each
+ yield "foo"
+ yield "bar"
+ end
+ r = Rack::Response.new(object_with_each)
r.write "foo"
status, header, body = r.finish
str = ""; body.each { |part| str << part }
--
1.7.7.5