Commit 071dc598 by Henrik N

Also test that new_user.avatar = old_user.avatar nils with a nil avatar.

parent 009aba0b
...@@ -199,12 +199,15 @@ class IntegrationTest < Test::Unit::TestCase ...@@ -199,12 +199,15 @@ class IntegrationTest < Test::Unit::TestCase
assert_equal "5k.png", @dummy.avatar_file_name assert_equal "5k.png", @dummy.avatar_file_name
end end
should "assign images from other Paperclips as well" do context "that is assigned its file from another Paperclip attachment" do
setup do
@dummy2 = Dummy.new @dummy2 = Dummy.new
@file2 = File.new(File.join(FIXTURES_DIR, "12k.png")) @file2 = File.new(File.join(FIXTURES_DIR, "12k.png"))
assert @dummy2.avatar = @file2 assert @dummy2.avatar = @file2
@dummy2.save @dummy2.save
end
should "work when assigned a file" do
assert_not_equal `identify -format "%wx%h" #{@dummy.avatar.to_file(:original).path}`, assert_not_equal `identify -format "%wx%h" #{@dummy.avatar.to_file(:original).path}`,
`identify -format "%wx%h" #{@dummy2.avatar.to_file(:original).path}` `identify -format "%wx%h" #{@dummy2.avatar.to_file(:original).path}`
...@@ -213,6 +216,18 @@ class IntegrationTest < Test::Unit::TestCase ...@@ -213,6 +216,18 @@ class IntegrationTest < Test::Unit::TestCase
assert_equal `identify -format "%wx%h" #{@dummy.avatar.to_file(:original).path}`, assert_equal `identify -format "%wx%h" #{@dummy.avatar.to_file(:original).path}`,
`identify -format "%wx%h" #{@dummy2.avatar.to_file(:original).path}` `identify -format "%wx%h" #{@dummy2.avatar.to_file(:original).path}`
end end
should "work when assigned a nil file" do
@dummy2.avatar = nil
@dummy2.save
@dummy.avatar = @dummy2.avatar
@dummy.save
assert !@dummy.avatar?
end
end
end end
if ENV['S3_TEST_BUCKET'] if ENV['S3_TEST_BUCKET']
......
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