Skip to content

Commit

Permalink
Add TestUploadFile.content_type= to match Request.UploadedFile
Browse files Browse the repository at this point in the history
[#920 state:resolved]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
  • Loading branch information
timhaines authored and jeremy committed Aug 28, 2008
1 parent 657898c commit 8277835
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion actionpack/lib/action_controller/test_process.rb
Expand Up @@ -331,7 +331,7 @@ class TestUploadedFile
attr_reader :original_filename attr_reader :original_filename


# The content type of the "uploaded" file # The content type of the "uploaded" file
attr_reader :content_type attr_accessor :content_type


def initialize(path, content_type = Mime::TEXT, binary = false) def initialize(path, content_type = Mime::TEXT, binary = false)
raise "#{path} file does not exist" unless File.exist?(path) raise "#{path} file does not exist" unless File.exist?(path)
Expand Down
5 changes: 5 additions & 0 deletions actionpack/test/controller/test_test.rb
Expand Up @@ -531,6 +531,11 @@ def test_test_uploaded_file
assert_equal content_type, file.content_type assert_equal content_type, file.content_type
assert_equal file.path, file.local_path assert_equal file.path, file.local_path
assert_equal expected, file.read 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 end


def test_test_uploaded_file_with_binary def test_test_uploaded_file_with_binary
Expand Down

0 comments on commit 8277835

Please sign in to comment.