test/task_test.rb in attachs-4.0.0.0 vs test/task_test.rb in attachs-4.0.0.1
- old
+ new
@@ -5,9 +5,29 @@
setup do
Dummy::Application.load_tasks
end
+ test 'exist' do
+ shop = Shop.create(name: 'first', logo: image)
+ shop.run_callbacks :commit
+ shop_old_path = shop.logo.paths[:original]
+ shop.update name: 'second'
+ shop.run_callbacks :commit
+ shop_path = shop.logo.paths[:original]
+
+ product = Product.create(pictures: [image, image])
+ product.run_callbacks :commit
+ product_path = product.pictures.first.paths[:original]
+
+ assert Attachs.exists?(shop_old_path)
+ assert Attachs.exists?(shop_path)
+ assert Attachs.exists?(product_path)
+
+ shop.logo.destroy
+ product.pictures.destroy
+ end
+
test 'reprocess' do
shop = Shop.new(logo: image)
assert_raises do
shop.logo.reprocess
end