Commit 56012bf3 by Prem Sichanugrist

S3::Object now throws error if the object doesn't exists

Fixes #743
parent 9ad074a0
...@@ -238,6 +238,8 @@ module Paperclip ...@@ -238,6 +238,8 @@ module Paperclip
else else
false false
end end
rescue AWS::Errors::Base => e
false
end end
def s3_permissions(style = default_style) def s3_permissions(style = default_style)
......
...@@ -542,6 +542,16 @@ class S3Test < Test::Unit::TestCase ...@@ -542,6 +542,16 @@ class S3Test < Test::Unit::TestCase
assert true assert true
end end
end end
context 'that the file were missing' do
setup do
AWS::S3::S3Object.any_instance.stubs(:exists?).raises(AWS::Errors::Base)
end
should 'return false on exists?' do
assert !@dummy.avatar.exists?
end
end
end end
end 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