Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
S3::Object now throws error if the object doesn't exists
Browse files Browse the repository at this point in the history
Fixes #743
  • Loading branch information
sikachu committed Feb 17, 2012
1 parent 9ad074a commit 56012bf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/paperclip/storage/s3.rb
Expand Up @@ -238,6 +238,8 @@ def exists?(style = default_style)
else
false
end
rescue AWS::Errors::Base => e
false
end

def s3_permissions(style = default_style)
Expand Down
10 changes: 10 additions & 0 deletions test/storage/s3_test.rb
Expand Up @@ -542,6 +542,16 @@ def counter
assert true
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

Expand Down

0 comments on commit 56012bf

Please sign in to comment.