lib/tap/test/http_test.rb in tap-http-0.3.2 vs lib/tap/test/http_test.rb in tap-http-0.4.0
- old
+ new
@@ -12,15 +12,17 @@
# validate echoed requests.
#
module HttpTest
class MockServer
- def initialize(body, status=200, headers={})
- @response = [status, headers, [body]]
+ def initialize(status=200, headers={}, &block)
+ @status = status
+ @headers = headers
+ @block = block
end
-
+
def call(env)
- @response
+ [@status, @headers, @block.call(env)]
end
end
class EchoServer
def self.call(env)