From f56b65965c29e312b90e265fe0935be07b72f726 Mon Sep 17 00:00:00 2001 From: Tim Haines Date: Thu, 28 Aug 2008 12:57:25 +1200 Subject: [PATCH] Add TestUploadFile.content_type= to match Request.UploadedFile --- actionpack/lib/action_controller/test_process.rb | 2 +- actionpack/test/controller/test_test.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletions(-) diff --git a/actionpack/lib/action_controller/test_process.rb b/actionpack/lib/action_controller/test_process.rb index c6b1470..a11fa7c 100644 --- a/actionpack/lib/action_controller/test_process.rb +++ b/actionpack/lib/action_controller/test_process.rb @@ -331,7 +331,7 @@ module ActionController #:nodoc: attr_reader :original_filename # The content type of the "uploaded" file - attr_reader :content_type + attr_accessor :content_type def initialize(path, content_type = Mime::TEXT, binary = false) raise "#{path} file does not exist" unless File.exist?(path) diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb index 58d9ca5..ff6871d 100644 --- a/actionpack/test/controller/test_test.rb +++ b/actionpack/test/controller/test_test.rb @@ -531,6 +531,11 @@ XML assert_equal content_type, file.content_type assert_equal file.path, file.local_path assert_equal expected, file.read + + new_content_type = "new content_type" + file.content_type = new_content_type + assert_equal new_content_type, file.content_type + end def test_test_uploaded_file_with_binary -- 1.5.6.1