Skip to content

Commit

Permalink
Test for thumbnail only if ImageMagick is present.
Browse files Browse the repository at this point in the history
  • Loading branch information
nasa42 committed Jul 27, 2015
1 parent 87e2153 commit 005932b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ def project_with_some_tasks(user, options = {})

return project
end

def imagemagick_present?
`which convert`.present?
end
end

module ActionController
Expand Down
8 changes: 6 additions & 2 deletions test/unit/project_file_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,18 @@ class ProjectFileTest < ActiveRecord::TestCase
should "be able to png files" do
photo = ProjectFile.make :file => Rails.root.join("app/assets/images/rails.png").open
assert photo.image?
assert photo.thumbnail?
if imagemagick_present?
assert photo.thumbnail?
end
assert File.exists?(photo.file_path)
end

should "be able to gif files" do
photo = ProjectFile.make :file => Rails.root.join("app/assets/images/ajax-bar-loader.gif").open
assert photo.image?
assert photo.thumbnail?
if imagemagick_present?
assert photo.thumbnail?
end
assert File.exists?(photo.file_path)
end
end
Expand Down

0 comments on commit 005932b

Please sign in to comment.