From dbf42e379becc5612a0efe3476a999a9d6d803f0 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 6 Mar 2007 09:46:04 +0000 Subject: Prefer MIME constants to strings. Closes #7707. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6350 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_controller/test_process.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'actionpack/lib/action_controller/test_process.rb') 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 -- cgit v1.2.3