Skip to content

Commit

Permalink
Added a test for reprocess\!
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Yurek committed May 13, 2008
1 parent 4e9acd6 commit 25628d1
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/test_integration.rb
Expand Up @@ -18,6 +18,37 @@ class IntegrationTest < Test::Unit::TestCase
end
end

context "An attachment" do
setup do
rebuild_model :styles => { :thumb => "50x50#" }
@dummy = Dummy.new
@file = File.new(File.join(File.dirname(__FILE__),
"fixtures",
"5k.png"))
@dummy.avatar = @file
assert @dummy.save
end

should "create its thumbnails properly" do
assert_match /\b50x50\b/, `identify '#{@dummy.avatar.path(:thumb)}'`
end

context "redefining its attachment styles" do
setup do
Dummy.class_eval do
has_attached_file :avatar, :styles => { :thumb => "150x25#" }
end
@d2 = Dummy.find(@dummy.id)
@d2.avatar.reprocess!
@d2.save
end

should "create its thumbnails properly" do
assert_match /\b150x25\b/, `identify '#{@dummy.avatar.path(:thumb)}'`
end
end
end

context "A model with no attachment validation" do
setup do
rebuild_model :styles => { :large => "300x300>",
Expand Down

0 comments on commit 25628d1

Please sign in to comment.