1 require 'abstract_unit'
2 require 'action_controller/integration'
3 require 'action_controller/routing'
5 unless defined? ApplicationController
6 class ApplicationController
< ActionController
::Base
10 class UploadTestController
< ActionController
::Base
14 SessionUploadTest
.last_request_type
= ActionController
::Base.param_parsers
[request
.content_type
]
15 render
:text => "got here"
19 class SessionUploadTest
< ActionController
::IntegrationTest
20 FILES_DIR
= File
.dirname(__FILE__
) + '/../fixtures/multipart'
23 attr_accessor
:last_request_type
27 # @session = ActionController::Integration::Session.new
29 def test_post_with_upload
30 uses_mocha
"test_post_with_upload" do
31 ActiveSupport
::Dependencies.stubs(:load?).returns(false)
34 map
.update
'update', :controller => "upload_test", :action => "update", :method => :post
37 params
= { :uploaded_data => fixture_file_upload(FILES_DIR
+ "/mona_lisa.jpg", "image/jpg") }
38 post
'/update', params
, :location => 'blah'
39 assert_equal(:multipart_form, SessionUploadTest
.last_request_type
)