diff options
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/integration_test.rb | 36 | ||||
-rw-r--r-- | actionpack/test/dispatch/routing_test.rb | 2 |
2 files changed, 37 insertions, 1 deletions
diff --git a/actionpack/test/controller/integration_test.rb b/actionpack/test/controller/integration_test.rb index 9044eff801..d3bc77d3ef 100644 --- a/actionpack/test/controller/integration_test.rb +++ b/actionpack/test/controller/integration_test.rb @@ -1281,3 +1281,39 @@ class IntegrationRequestEncodersTest < ActionDispatch::IntegrationTest end end end + +class IntegrationFileUploadTest < ActionDispatch::IntegrationTest + class IntegrationController < ActionController::Base + def test_file_upload + render plain: params[:file].size + end + end + + def self.routes + @routes ||= ActionDispatch::Routing::RouteSet.new + end + + def self.call(env) + routes.call(env) + end + + def app + self.class + end + + def self.fixture_path + File.dirname(__FILE__) + "/../fixtures/multipart" + end + + routes.draw do + post "test_file_upload", to: "integration_file_upload_test/integration#test_file_upload" + end + + def test_fixture_file_upload + post "/test_file_upload", + params: { + file: fixture_file_upload("/mona_lisa.jpg", "image/jpg") + } + assert_equal "159528", @response.body + end +end diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index eec34dba66..6ba52e37b6 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -3693,7 +3693,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest assert_equal "admin/pages#index", @response.body end - def test_namespaced_roots + def test_multiple_namespaced_roots draw do namespace :foo do root "test#index" |