Commit 2e540f89 by Jon Yurek

Fixes failing tests

parent 67580ee3
......@@ -2,7 +2,7 @@ source "https://rubygems.org"
gemspec
gem 'sqlite3', '1.3.8', :platforms => :ruby
gem 'sqlite3', '~> 1.3.8', :platforms => :ruby
gem 'jruby-openssl', :platforms => :jruby
gem 'activerecord-jdbcsqlite3-adapter', :platforms => :jruby
......
......@@ -3,32 +3,32 @@ require 'spec_helper'
describe Paperclip::MediaTypeSpoofDetector do
it 'rejects 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?
assert Paperclip::MediaTypeSpoofDetector.using(file, "5k.html", "image/png").spoofed?
end
it 'does 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?
assert ! Paperclip::MediaTypeSpoofDetector.using(file, "5k.jpg", "image/png").spoofed?
end
it 'does 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?
assert ! Paperclip::MediaTypeSpoofDetector.using(file, "empty.html", "text/html").spoofed?
end
it 'does not reject a file that does not have a name' do
file = File.open(fixture_file("empty.html"))
assert ! Paperclip::MediaTypeSpoofDetector.using(file, "").spoofed?
assert ! Paperclip::MediaTypeSpoofDetector.using(file, "", "").spoofed?
end
it 'does not reject a file that does have an extension' do
file = File.open(fixture_file("empty.html"))
assert ! Paperclip::MediaTypeSpoofDetector.using(file, "data").spoofed?
assert ! Paperclip::MediaTypeSpoofDetector.using(file, "data", "").spoofed?
end
it 'does 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?
assert ! Paperclip::MediaTypeSpoofDetector.using(adapter, adapter.original_filename, adapter.content_type).spoofed?
end
it 'does not reject when the extension => content_type is in :content_type_mappings' do
......@@ -38,7 +38,7 @@ describe Paperclip::MediaTypeSpoofDetector do
file.puts "Certificate!"
file.close
adapter = Paperclip.io_adapters.for(File.new(file.path));
assert ! Paperclip::MediaTypeSpoofDetector.using(adapter, adapter.original_filename).spoofed?
assert ! Paperclip::MediaTypeSpoofDetector.using(adapter, adapter.original_filename, adapter.content_type).spoofed?
ensure
Paperclip.options[:content_type_mappings] = {}
end
......@@ -49,7 +49,7 @@ describe Paperclip::MediaTypeSpoofDetector do
assert Paperclip::MediaTypeSpoofDetector.using(file, "empty.html", "image/jpg").spoofed?
end
it "does not reject is content_type is empty but otherwise checks out" do
it "does not reject if content_type is empty but otherwise checks out" do
file = File.open(fixture_file("empty.html"))
assert ! Paperclip::MediaTypeSpoofDetector.using(file, "empty.html", "").spoofed?
end
......
......@@ -20,7 +20,7 @@ describe Paperclip do
it "saves Cocaine::CommandLine.path that set before" do
Cocaine::CommandLine.path = "/opt/my_app/bin"
Paperclip.run("convert", "stuff")
assert_equal [Cocaine::CommandLine.path].flatten.include?("/opt/my_app/bin"), true
expect(Cocaine::CommandLine.path).to match("/opt/my_app/bin")
end
it "does not duplicate Cocaine::CommandLine.path on multiple runs" do
......
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