diff options
-rw-r--r-- | actionpack/lib/action_dispatch/http/upload.rb | 2 | ||||
-rw-r--r-- | actionpack/test/controller/test_test.rb | 5 | ||||
-rw-r--r-- | actionpack/test/dispatch/uploaded_file_test.rb | 2 |
3 files changed, 4 insertions, 5 deletions
diff --git a/actionpack/lib/action_dispatch/http/upload.rb b/actionpack/lib/action_dispatch/http/upload.rb index 94fa747a79..eb95f79e0b 100644 --- a/actionpack/lib/action_dispatch/http/upload.rb +++ b/actionpack/lib/action_dispatch/http/upload.rb @@ -19,7 +19,7 @@ module ActionDispatch [:open, :path, :rewind, :size].each do |method| class_eval "def #{method}; @tempfile.#{method}; end" end - + private def encode_filename(filename) # Encode the filename in the utf8 encoding, unless it is nil or we're in 1.8 diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb index 677a933ccb..1da5298900 100644 --- a/actionpack/test/controller/test_test.rb +++ b/actionpack/test/controller/test_test.rb @@ -767,9 +767,8 @@ XML end def test_action_dispatch_uploaded_file_upload - filename = 'mona_lisa.jpg' - path = "#{FILES_DIR}/#{filename}" - post :test_file_upload, :file => ActionDispatch::Http::UploadedFile.new(:filename => path, :type => "image/jpg", :tempfile => File.open(path)) + tf = Class.new { def size; 159528 end } + post :test_file_upload, :file => ActionDispatch::Http::UploadedFile.new(:tempfile => tf.new) assert_equal '159528', @response.body end diff --git a/actionpack/test/dispatch/uploaded_file_test.rb b/actionpack/test/dispatch/uploaded_file_test.rb index 7e4a1519fb..fae39a403e 100644 --- a/actionpack/test/dispatch/uploaded_file_test.rb +++ b/actionpack/test/dispatch/uploaded_file_test.rb @@ -12,7 +12,7 @@ module ActionDispatch uf = Http::UploadedFile.new(:filename => 'foo', :tempfile => Object.new) assert_equal 'foo', uf.original_filename end - + if "ruby".encoding_aware? def test_filename_should_be_in_utf_8 uf = Http::UploadedFile.new(:filename => 'foo', :tempfile => Object.new) |