aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/test_process.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_controller/test_process.rb')
-rw-r--r--actionpack/lib/action_controller/test_process.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/actionpack/lib/action_controller/test_process.rb b/actionpack/lib/action_controller/test_process.rb
index beccec6f94..b1eb9e38ef 100644
--- a/actionpack/lib/action_controller/test_process.rb
+++ b/actionpack/lib/action_controller/test_process.rb
@@ -325,29 +325,29 @@ module ActionController #:nodoc:
class TestUploadedFile
# The filename, *not* including the path, of the "uploaded" file
attr_reader :original_filename
-
+
# The content type of the "uploaded" file
attr_reader :content_type
-
- def initialize(path, content_type = 'text/plain')
+
+ def initialize(path, content_type = Mime::TEXT)
raise "#{path} file does not exist" unless File.exist?(path)
@content_type = content_type
@original_filename = path.sub(/^.*#{File::SEPARATOR}([^#{File::SEPARATOR}]+)$/) { $1 }
@tempfile = Tempfile.new(@original_filename)
FileUtils.copy_file(path, @tempfile.path)
end
-
+
def path #:nodoc:
@tempfile.path
end
-
+
alias local_path path
-
+
def method_missing(method_name, *args, &block) #:nodoc:
@tempfile.send(method_name, *args, &block)
end
end
-
+
module TestProcess
def self.included(base)
# execute the request simulating a specific http method and set/volley the response