Commit 189ee9c3 by Tom Hughes

Clear the fingerprint when an attachment is removed

parent 22a2a85d
...@@ -462,6 +462,7 @@ module Paperclip ...@@ -462,6 +462,7 @@ module Paperclip
instance_write(:file_name, nil) instance_write(:file_name, nil)
instance_write(:content_type, nil) instance_write(:content_type, nil)
instance_write(:file_size, nil) instance_write(:file_size, nil)
instance_write(:fingerprint, nil)
instance_write(:updated_at, nil) instance_write(:updated_at, nil)
end end
......
...@@ -925,6 +925,7 @@ class AttachmentTest < Test::Unit::TestCase ...@@ -925,6 +925,7 @@ class AttachmentTest < Test::Unit::TestCase
@attachment.expects(:instance_write).with(:file_name, nil) @attachment.expects(:instance_write).with(:file_name, nil)
@attachment.expects(:instance_write).with(:content_type, nil) @attachment.expects(:instance_write).with(:content_type, nil)
@attachment.expects(:instance_write).with(:file_size, nil) @attachment.expects(:instance_write).with(:file_size, nil)
@attachment.expects(:instance_write).with(:fingerprint, nil)
@attachment.expects(:instance_write).with(:updated_at, nil) @attachment.expects(:instance_write).with(:updated_at, nil)
@attachment.assign nil @attachment.assign nil
@attachment.save @attachment.save
...@@ -935,6 +936,7 @@ class AttachmentTest < Test::Unit::TestCase ...@@ -935,6 +936,7 @@ class AttachmentTest < Test::Unit::TestCase
@attachment.expects(:instance_write).with(:file_name, nil) @attachment.expects(:instance_write).with(:file_name, nil)
@attachment.expects(:instance_write).with(:content_type, nil) @attachment.expects(:instance_write).with(:content_type, nil)
@attachment.expects(:instance_write).with(:file_size, nil) @attachment.expects(:instance_write).with(:file_size, nil)
@attachment.expects(:instance_write).with(:fingerprint, nil)
@attachment.expects(:instance_write).with(:updated_at, nil) @attachment.expects(:instance_write).with(:updated_at, nil)
@attachment.clear @attachment.clear
@attachment.save @attachment.save
...@@ -945,6 +947,7 @@ class AttachmentTest < Test::Unit::TestCase ...@@ -945,6 +947,7 @@ class AttachmentTest < Test::Unit::TestCase
@attachment.expects(:instance_write).with(:file_name, nil) @attachment.expects(:instance_write).with(:file_name, nil)
@attachment.expects(:instance_write).with(:content_type, nil) @attachment.expects(:instance_write).with(:content_type, nil)
@attachment.expects(:instance_write).with(:file_size, nil) @attachment.expects(:instance_write).with(:file_size, nil)
@attachment.expects(:instance_write).with(:fingerprint, nil)
@attachment.expects(:instance_write).with(:updated_at, nil) @attachment.expects(:instance_write).with(:updated_at, nil)
@attachment.destroy @attachment.destroy
@existing_names.each{|f| assert ! File.exists?(f) } @existing_names.each{|f| assert ! File.exists?(f) }
...@@ -959,6 +962,7 @@ class AttachmentTest < Test::Unit::TestCase ...@@ -959,6 +962,7 @@ class AttachmentTest < Test::Unit::TestCase
@attachment.expects(:instance_write).with(:file_name, nil) @attachment.expects(:instance_write).with(:file_name, nil)
@attachment.expects(:instance_write).with(:content_type, nil) @attachment.expects(:instance_write).with(:content_type, nil)
@attachment.expects(:instance_write).with(:file_size, nil) @attachment.expects(:instance_write).with(:file_size, nil)
@attachment.expects(:instance_write).with(:fingerprint, nil)
@attachment.expects(:instance_write).with(:updated_at, nil) @attachment.expects(:instance_write).with(:updated_at, nil)
@attachment.assign nil @attachment.assign nil
@attachment.save @attachment.save
...@@ -969,6 +973,7 @@ class AttachmentTest < Test::Unit::TestCase ...@@ -969,6 +973,7 @@ class AttachmentTest < Test::Unit::TestCase
@attachment.expects(:instance_write).with(:file_name, nil) @attachment.expects(:instance_write).with(:file_name, nil)
@attachment.expects(:instance_write).with(:content_type, nil) @attachment.expects(:instance_write).with(:content_type, nil)
@attachment.expects(:instance_write).with(:file_size, nil) @attachment.expects(:instance_write).with(:file_size, nil)
@attachment.expects(:instance_write).with(:fingerprint, nil)
@attachment.expects(:instance_write).with(:updated_at, nil) @attachment.expects(:instance_write).with(:updated_at, nil)
@attachment.clear @attachment.clear
@attachment.save @attachment.save
...@@ -979,6 +984,7 @@ class AttachmentTest < Test::Unit::TestCase ...@@ -979,6 +984,7 @@ class AttachmentTest < Test::Unit::TestCase
@attachment.expects(:instance_write).with(:file_name, nil) @attachment.expects(:instance_write).with(:file_name, nil)
@attachment.expects(:instance_write).with(:content_type, nil) @attachment.expects(:instance_write).with(:content_type, nil)
@attachment.expects(:instance_write).with(:file_size, nil) @attachment.expects(:instance_write).with(:file_size, nil)
@attachment.expects(:instance_write).with(:fingerprint, nil)
@attachment.expects(:instance_write).with(:updated_at, nil) @attachment.expects(:instance_write).with(:updated_at, nil)
@attachment.destroy @attachment.destroy
@existing_names.each{|f| assert File.exists?(f) } @existing_names.each{|f| assert File.exists?(f) }
......
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