Commit 1e1e7577 by jyurek

Tests fleshing out the coverage of different geometry modifiers.

git-svn-id: https://svn.thoughtbot.com/plugins/paperclip/trunk@445 7bbfaf0e-4d1d-0410-9690-a8bb5f8ef2aa
parent 109ee7f1
...@@ -42,6 +42,37 @@ class ThumbnailTest < Test::Unit::TestCase ...@@ -42,6 +42,37 @@ class ThumbnailTest < Test::Unit::TestCase
@file = File.new(File.join(File.dirname(__FILE__), "fixtures", "5k.png")) @file = File.new(File.join(File.dirname(__FILE__), "fixtures", "5k.png"))
end end
[["600x600>", "434x66"],
["400x400>", "400x61"],
["32x32<", "434x66"]
].each do |args|
context "being thumbnailed with a geometry of #{args[0]}" do
setup do
@thumb = Paperclip::Thumbnail.new(@file, args[0])
end
should "start with dimensions of 434x66" do
cmd = %Q[identify -format "%wx%h" #{@file.path}]
assert_equal "434x66", `#{cmd}`.chomp
end
should "report the correct target geometry" do
assert_equal args[0], @thumb.target_geometry.to_s
end
context "when made" do
setup do
@thumb_result = @thumb.make
end
should "be the size we expect it to be" do
cmd = %Q[identify -format "%wx%h" #{@thumb_result.path}]
assert_equal args[1], `#{cmd}`.chomp
end
end
end
end
context "being thumbnailed at 100x50 with cropping" do context "being thumbnailed at 100x50 with cropping" do
setup do setup do
@thumb = Paperclip::Thumbnail.new(@file, "100x50#") @thumb = Paperclip::Thumbnail.new(@file, "100x50#")
......
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