aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/metal_test.rb
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2010-01-17 03:20:30 +0530
committerPratik Naik <pratiknaik@gmail.com>2010-01-17 03:20:30 +0530
commitb04230e3bbf912d60601e9e7b797c4cd43581d51 (patch)
tree97a2f784a2ec2bfae4f960af56a9280dad6f7774 /railties/test/metal_test.rb
parent867829b187969607aa12f2b0457f25da9c204db0 (diff)
parent6e3bee6cf1f0d2684152292db0a8b757249824fd (diff)
downloadrails-b04230e3bbf912d60601e9e7b797c4cd43581d51.tar.gz
rails-b04230e3bbf912d60601e9e7b797c4cd43581d51.tar.bz2
rails-b04230e3bbf912d60601e9e7b797c4cd43581d51.zip
Merge remote branch 'mainstream/master'
Conflicts: actionpack/lib/action_controller/metal/flash.rb
Diffstat (limited to 'railties/test/metal_test.rb')
-rw-r--r--railties/test/metal_test.rb101
1 files changed, 0 insertions, 101 deletions
diff --git a/railties/test/metal_test.rb b/railties/test/metal_test.rb
deleted file mode 100644
index 91f55c2b5e..0000000000
--- a/railties/test/metal_test.rb
+++ /dev/null
@@ -1,101 +0,0 @@
-require 'abstract_unit'
-
-class MetalTest < Test::Unit::TestCase
- def test_metals_should_return_list_of_found_metal_apps
- use_appdir("singlemetal") do
- assert_equal(["FooMetal"], found_metals_as_string_array)
- end
- end
-
- def test_metals_should_respect_class_name_conventions
- use_appdir("pluralmetal") do
- assert_equal(["LegacyRoutes"], found_metals_as_string_array)
- end
- end
-
- def test_metals_should_return_alphabetical_list_of_found_metal_apps
- use_appdir("multiplemetals") do
- assert_equal(["MetalA", "MetalB"], found_metals_as_string_array)
- end
- end
-
- def test_metals_load_order_should_be_overriden_by_requested_metals
- use_appdir("multiplemetals") do
- Rails::Rack::Metal.requested_metals = ["MetalB", "MetalA"]
- assert_equal(["MetalB", "MetalA"], found_metals_as_string_array)
- end
- end
-
- def test_metals_not_listed_should_not_load
- use_appdir("multiplemetals") do
- Rails::Rack::Metal.requested_metals = ["MetalB"]
- assert_equal(["MetalB"], found_metals_as_string_array)
- end
- end
-
- def test_metal_finding_should_work_with_subfolders
- use_appdir("subfolders") do
- assert_equal(["Folder::MetalA", "Folder::MetalB"], found_metals_as_string_array)
- end
- end
-
- def test_metal_finding_with_requested_metals_should_work_with_subfolders
- use_appdir("subfolders") do
- Rails::Rack::Metal.requested_metals = ["Folder::MetalB"]
- assert_equal(["Folder::MetalB"], found_metals_as_string_array)
- end
- end
-
- def test_metal_finding_should_work_with_multiple_metal_paths_in_185_and_below
- use_appdir("singlemetal") do
- engine_metal_path = "#{File.dirname(__FILE__)}/fixtures/plugins/engines/engine/app/metal"
- Rails::Rack::Metal.metal_paths << engine_metal_path
- $LOAD_PATH << engine_metal_path
- 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{|env|[402,{},["End of the Line"]]}
- end
-
- def use_appdir(root)
- dir = "#{File.dirname(__FILE__)}/fixtures/metal/#{root}"
- Rails::Rack::Metal.metal_paths = ["#{dir}/app/metal"]
- Rails::Rack::Metal.requested_metals = nil
- $LOAD_PATH << "#{dir}/app/metal"
- yield
- end
-
- def found_metals_as_string_array
- Rails::Rack::Metal.metals.map { |m| m.to_s }
- end
-end