aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/metal_test.rb
diff options
context:
space:
mode:
authorJohn Duff <duff.john@gmail.com>2009-07-22 22:21:06 -0500
committerJoshua Peek <josh@joshpeek.com>2009-07-22 22:21:06 -0500
commit0c68d23f19010379a9320690ca17a26743c8f071 (patch)
treec494e9391ba81f5099c2abf873c26e9177ccc6c3 /railties/test/metal_test.rb
parent272c504f919d187603915059572e37d3a78329cc (diff)
downloadrails-0c68d23f19010379a9320690ca17a26743c8f071.tar.gz
rails-0c68d23f19010379a9320690ca17a26743c8f071.tar.bz2
rails-0c68d23f19010379a9320690ca17a26743c8f071.zip
make pass through error code configurable [#2817 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
Diffstat (limited to 'railties/test/metal_test.rb')
-rw-r--r--railties/test/metal_test.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/railties/test/metal_test.rb b/railties/test/metal_test.rb
index d3d231132b..c79a819a76 100644
--- a/railties/test/metal_test.rb
+++ b/railties/test/metal_test.rb
@@ -55,8 +55,38 @@ class MetalTest < Test::Unit::TestCase
assert_equal(["FooMetal", "EngineMetal"], found_metals_as_string_array)
end
end
+
+ def test_metal_default_pass_through_on_404
+ use_appdir("multiplemetals") do
+ result = Rails::Rack::Metal.new(app).call({})
+ assert_equal 200, result.first
+ assert_equal ["Metal B"], result.last
+ end
+ end
+
+ def test_metal_pass_through_on_417
+ use_appdir("multiplemetals") do
+ Rails::Rack::Metal.pass_through_on = 417
+ result = Rails::Rack::Metal.new(app).call({})
+ assert_equal 404, result.first
+ assert_equal ["Metal A"], result.last
+ end
+ end
+
+ def test_metal_pass_through_on_404_and_200
+ use_appdir("multiplemetals") do
+ Rails::Rack::Metal.pass_through_on = [404, 200]
+ result = Rails::Rack::Metal.new(app).call({})
+ assert_equal 402, result.first
+ assert_equal ["End of the Line"], result.last
+ end
+ end
private
+
+ def app
+ lambda{[402,{},["End of the Line"]]}
+ end
def use_appdir(root)
dir = "#{File.dirname(__FILE__)}/fixtures/metal/#{root}"