Commit f647d680 by Prem Sichanugrist

Add test case for attachment assignment from S3

parent 3f1d30fb
......@@ -12,9 +12,11 @@ unless ENV["S3_BUCKET"].blank?
:path => ":class/:attachment/:id/:style.:extension",
:s3_credentials => @s3_credentials
@dummy = Dummy.new
@attachment = Dummy.new.avatar
@file = File.new(fixture_file("5k.png"))
end
should "not raise any error" do
@attachment = Dummy.new.avatar
@attachment.assign(@file)
@attachment.save
......@@ -23,6 +25,16 @@ unless ENV["S3_BUCKET"].blank?
@attachment2.save
end
should "allow assignment from another S3 object" do
@attachment = Dummy.new.avatar
@attachment.assign(@file)
@attachment.save
@attachment2 = Dummy.new.avatar
@attachment2.assign(@attachment)
@attachment2.save
end
teardown { [@s3_credentials, @file].each(&:close) }
end
......@@ -37,6 +49,7 @@ unless ENV["S3_BUCKET"].blank?
@dummy = Dummy.new
end
should "return nil" do
assert_nil @dummy.avatar.expiring_url
end
......
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