Commit d42adb8a by Zach Millman Committed by Jon Yurek

Add test for inferring content type from uploaded file

Added the sample .mp4 file from Apple's QuickTime sample page:
http://support.apple.com/kb/ht1425
parent 04af5821
......@@ -15,6 +15,11 @@ class ContentTypeDetectorTest < Test::Unit::TestCase
assert_equal "text/plain", Paperclip::ContentTypeDetector.new(tempfile.path).detect
end
should 'return content type of uploaded file if it is an acceptable type' do
@filename = fixture_file("sample_mpeg4.mp4")
assert_equal "video/mp4", Paperclip::ContentTypeDetector.new(@filename).detect
end
should 'return an empty content type if the file is empty' do
tempfile = Tempfile.new("something")
tempfile.rewind
......@@ -36,5 +41,7 @@ class ContentTypeDetectorTest < Test::Unit::TestCase
@filename = "/path/to/something"
assert_equal "application/octet-stream", Paperclip::ContentTypeDetector.new(@filename).detect
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment