Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Refactor spec_cascade and spec_head

 * StringIO is a better choice than a struct here.
  • Loading branch information...
commit b79612ef92e0e897f4e51f828b57ed025baa2fef 1 parent f630f78
@raggi raggi authored
Showing with 2 additions and 23 deletions.
  1. +1 −11 test/spec_cascade.rb
  2. +1 −12 test/spec_head.rb
View
12 test/spec_cascade.rb
@@ -52,17 +52,7 @@ def cascade(*args)
end
should "close the body on cascade" do
- body = Struct.new(:body, :closed) do
- def each
- yield body
- end
-
- def close
- self.closed = true
- end
- alias closed? closed
- end.new("", false)
-
+ body = StringIO.new
closer = lambda { |env| [404, {}, body] }
cascade = Rack::Cascade.new([closer, app3], [404])
Rack::MockRequest.new(cascade).get("/foo").should.be.ok
View
13 test/spec_head.rb
@@ -5,19 +5,8 @@
describe Rack::Head do
- @closable_body = Struct.new(:body, :closed) do
- def each
- yield body
- end
-
- def close
- self.closed = true
- end
- alias closed? closed
- end
-
def test_response(headers = {})
- body = @closable_body.new("foo", false)
+ body = StringIO.new "foo"
app = lambda do |env|
[200, {"Content-type" => "test/plain", "Content-length" => "3"}, body]
end
Please sign in to comment.
Something went wrong with that request. Please try again.