Commit ceab018b by Jon Yurek

Do not run post_processing if the attachment is not valid.

parent 17a03b28
......@@ -83,7 +83,7 @@ module Paperclip
@dirty = true
post_process
post_process if valid?
# Reset the file size if the original file was reprocessed.
instance_write(:file_size, uploaded_file.size.to_i)
......
......@@ -163,6 +163,7 @@ class AttachmentTest < Test::Unit::TestCase
@attachment.expects(:valid_assignment?).with(@not_file).returns(true)
@attachment.expects(:queue_existing_for_delete)
@attachment.expects(:post_process)
@attachment.expects(:valid?).returns(true)
@attachment.expects(:validate)
@dummy.avatar = @not_file
end
......@@ -192,6 +193,7 @@ class AttachmentTest < Test::Unit::TestCase
@attachment.expects(:valid_assignment?).with(@not_file).returns(true)
@attachment.expects(:queue_existing_for_delete)
@attachment.expects(:post_process)
@attachment.expects(:valid?).returns(true)
@attachment.expects(:validate)
@dummy.avatar = @not_file
end
......
......@@ -209,7 +209,7 @@ class IntegrationTest < Test::Unit::TestCase
@dummy.avatar = @bad_file
assert ! @dummy.valid?
@dummy.avatar = nil
assert @dummy.valid?
assert @dummy.valid?, @dummy.errors.inspect
end
should "know the difference between good files, bad files, not files, and nil when validating" 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