aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/integration_test.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/actionpack/test/controller/integration_test.rb b/actionpack/test/controller/integration_test.rb
index fd985a9a46..90afbfb9bc 100644
--- a/actionpack/test/controller/integration_test.rb
+++ b/actionpack/test/controller/integration_test.rb
@@ -373,4 +373,39 @@ class IntegrationProcessTest < ActionController::IntegrationTest
end
end
+class MetalTest < ActionController::IntegrationTest
+ require(File.dirname(__FILE__) + "/../../../railties/lib/rails/rack/metal.rb")
+
+ class Poller < ::Rails::Rack::Metal
+ def call(env)
+ if env["PATH_INFO"] =~ /^\/success/
+ [200, {"Content-Type" => "text/plain"}, "Hello World!"]
+ elsif env["PATH_INFO"] =~ /^\/failure/
+ [404, {"Content-Type" => "text/plain"}, '']
+ else
+ super
+ end
+ end
+ end
+
+ def setup
+ @integration_session = ActionController::Integration::Session.new(Poller)
+ end
+
+ def test_successful_get
+ get "/success"
+ assert_response 200
+ assert_response :success
+ assert_response :ok
+ assert_equal "Hello World!", response.body
+ end
+
+ def test_failed_get
+ get "/failure"
+ assert_response 404
+ assert_response :not_found
+ assert_equal '', response.body
+ end
+end
+
end