diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-03-06 09:46:04 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-03-06 09:46:04 +0000 |
commit | dbf42e379becc5612a0efe3476a999a9d6d803f0 (patch) | |
tree | 63809e19f53fc202369acae0bd027ba2352b9d2a /actionpack/lib/action_controller/test_process.rb | |
parent | e0cded2bbfc72ebbdae5b3c5926dc67f8fb59631 (diff) | |
download | rails-dbf42e379becc5612a0efe3476a999a9d6d803f0.tar.gz rails-dbf42e379becc5612a0efe3476a999a9d6d803f0.tar.bz2 rails-dbf42e379becc5612a0efe3476a999a9d6d803f0.zip |
Prefer MIME constants to strings. Closes #7707.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6350 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller/test_process.rb')
-rw-r--r-- | actionpack/lib/action_controller/test_process.rb | 14 |
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 |