Skip to content

Commit

Permalink
Fix #exists? returning true after Fog file deletion
Browse files Browse the repository at this point in the history
Fixes #2387, Refs. bffbaaf
  • Loading branch information
mshibuya committed May 22, 2019
1 parent 3f540b9 commit f94b061
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/carrierwave/storage/fog.rb
Expand Up @@ -242,7 +242,9 @@ def content_type=(new_content_type)
#
def delete
# avoid a get by just using local reference
directory.files.new(:key => path).destroy
directory.files.new(:key => path).destroy.tap do |result|
@file = nil if result
end
end

##
Expand Down
4 changes: 4 additions & 0 deletions spec/storage/fog_helper.rb
Expand Up @@ -258,6 +258,10 @@ class FogSpec#{fog_credentials[:provider]}Uploader < CarrierWave::Uploader::Base
it "should not return false for content type" do
expect(@fog_file.content_type).not_to be false
end

it "should let #exists? be false" do
expect(@fog_file.exists?).to be false
end
end
end

Expand Down

0 comments on commit f94b061

Please sign in to comment.