diff options
author | José Valim <jose.valim@gmail.com> | 2009-07-28 09:00:33 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2009-07-28 09:00:33 +0200 |
commit | d9aae2b56e64a4f417eaffa99e10cca274e928e7 (patch) | |
tree | 8438f6f784df9b252c0f834bc7cb9c369103d4cd /railties/test/metal_test.rb | |
parent | 5025ae610f89989f3e15241ec7065e3d443614d9 (diff) | |
parent | 9533e0eca76b1df68a90e1ebe395d7b6a59d8e91 (diff) | |
download | rails-d9aae2b56e64a4f417eaffa99e10cca274e928e7.tar.gz rails-d9aae2b56e64a4f417eaffa99e10cca274e928e7.tar.bz2 rails-d9aae2b56e64a4f417eaffa99e10cca274e928e7.zip |
Merge branch 'master' of git://github.com/rails/rails
Diffstat (limited to 'railties/test/metal_test.rb')
-rw-r--r-- | railties/test/metal_test.rb | 30 |
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}" |