test/attachment_test.rb in thoughtbot-paperclip-2.2.7 vs test/attachment_test.rb in thoughtbot-paperclip-2.2.8
- old
+ new
@@ -597,17 +597,17 @@
@existing_names = @attachment.styles.keys.collect do |style|
@attachment.path(style)
end
end
- should "not delete the files saving in a deprecated manner" do
- @attachment.expects(:instance_write).with(:file_name, nil).never
- @attachment.expects(:instance_write).with(:content_type, nil).never
- @attachment.expects(:instance_write).with(:file_size, nil).never
- @attachment.expects(:instance_write).with(:updated_at, nil).never
+ should "delete the files after assigning nil" do
+ @attachment.expects(:instance_write).with(:file_name, nil)
+ @attachment.expects(:instance_write).with(:content_type, nil)
+ @attachment.expects(:instance_write).with(:file_size, nil)
+ @attachment.expects(:instance_write).with(:updated_at, nil)
@attachment.assign nil
@attachment.save
- @existing_names.each{|f| assert File.exists?(f) }
+ @existing_names.each{|f| assert ! File.exists?(f) }
end
should "delete the files when you call #clear and #save" do
@attachment.expects(:instance_write).with(:file_name, nil)
@attachment.expects(:instance_write).with(:content_type, nil)