Sha256: 837402a818f51a21467b64244ae75f821ed815724eefe44336eb842507d205d6
Contents?: true
Size: 1.1 KB
Versions: 1
Compression:
Stored size: 1.1 KB
Contents
require './test/helper' class MediaTypeSpoofDetectorTest < Test::Unit::TestCase should 'reject a file that is named .html and identifies as PNG' do file = File.open(fixture_file("5k.png")) assert Paperclip::MediaTypeSpoofDetector.using(file, "5k.html").spoofed? end should 'not reject a file that is named .jpg and identifies as PNG' do file = File.open(fixture_file("5k.png")) assert ! Paperclip::MediaTypeSpoofDetector.using(file, "5k.jpg").spoofed? end should 'not reject a file that is named .html and identifies as HTML' do file = File.open(fixture_file("empty.html")) assert ! Paperclip::MediaTypeSpoofDetector.using(file, "empty.html").spoofed? end should 'not reject a file that does not have a name' do file = File.open(fixture_file("empty.html")) assert ! Paperclip::MediaTypeSpoofDetector.using(file, "").spoofed? end should 'not reject when the supplied file is an IOAdapter' do adapter = Paperclip.io_adapters.for(File.new(fixture_file("5k.png"))) assert ! Paperclip::MediaTypeSpoofDetector.using(adapter, adapter.original_filename).spoofed? end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
paperclip-4.0.0 | test/media_type_spoof_detector_test.rb |