Skip to content
This repository was archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
Fixes failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Yurek committed Jun 5, 2015
1 parent 67580ee commit 2e540f8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions spec/paperclip/media_type_spoof_detector_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,32 @@
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
Expand All @@ -38,7 +38,7 @@
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
Expand All @@ -49,7 +49,7 @@
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
Expand Down
2 changes: 1 addition & 1 deletion spec/paperclip/paperclip_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
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
Expand Down

0 comments on commit 2e540f8

Please sign in to comment.