Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 20 lines (16 sloc) 0.611 kB
25595e1 @mpalmer Switch to using minitest
mpalmer authored
1 require 'minitest/autorun'
50fd7a3 @lifo Rack::Evil - The name says it all
lifo authored
2 require 'rack/mock'
3 require 'rack/contrib/evil'
4 require 'erb'
5
25595e1 @mpalmer Switch to using minitest
mpalmer authored
6 describe "Rack::Evil" do
50fd7a3 @lifo Rack::Evil - The name says it all
lifo authored
7 app = lambda do |env|
8 template = ERB.new("<%= throw :response, [404, {'Content-Type' => 'text/html'}, 'Never know where it comes from'] %>")
9 [200, {'Content-Type' => 'text/plain'}, template.result(binding)]
10 end
11
12 specify "should enable the app to return the response from anywhere" do
13 status, headers, body = Rack::Evil.new(app).call({})
14
25595e1 @mpalmer Switch to using minitest
mpalmer authored
15 status.must_equal 404
16 headers['Content-Type'].must_equal 'text/html'
17 body.must_equal 'Never know where it comes from'
50fd7a3 @lifo Rack::Evil - The name says it all
lifo authored
18 end
19 end
Something went wrong with that request. Please try again.