Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Extra tests for #947 to check works in more situations

  • Loading branch information...
commit 073c06c1ed450cf8150e4702a1a5f3b4b51c717b 1 parent b256381
Tom Counsell tamc authored sikachu committed
Showing with 20 additions and 3 deletions.
  1. +20 −3 test/integration_test.rb
23 test/integration_test.rb
View
@@ -641,7 +641,7 @@ def s3_headers_for attachment, style
end
end
- context "Copying attachment between models" do
+ context "Copying attachments between models" do
setup do
rebuild_model
@file = File.new(fixture_file("5k.png"), 'rb')
@@ -649,11 +649,28 @@ def s3_headers_for attachment, style
teardown { @file.close }
- should "should succeed when attachment is empty" do
+ should "succeed when original attachment is a file" do
+ original = Dummy.new
+ original.avatar = @file
+ assert original.save
+
+ copy = Dummy.new
+ copy.avatar = original.avatar
+ assert copy.save
+
+ assert copy.avatar.present?
+ end
+
+ should "succeed when original attachment is empty" do
original = Dummy.create!
+
copy = Dummy.new
+ copy.avatar = @file
+ assert copy.save
+ assert copy.avatar.present?
+
copy.avatar = original.avatar
- copy.save
+ assert copy.save
assert !copy.avatar.present?
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.