Skip to content

Commit

Permalink
Make #2384 work with Ruby 2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
mshibuya committed Apr 30, 2019
1 parent 588a93b commit 0195c8c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/carrierwave/storage/fog.rb
Expand Up @@ -216,7 +216,7 @@ def authenticated_url(options = {})
# [String] value of content-type
#
def content_type
@content_type || file&.content_type
@content_type || file.try(:content_type)
end

##
Expand Down
8 changes: 6 additions & 2 deletions spec/storage/fog_helper.rb
Expand Up @@ -251,8 +251,12 @@ class FogSpec#{fog_credentials[:provider]}Uploader < CarrierWave::Uploader::Base
expect { @fog_file.size }.not_to raise_error
end

it "should return a string or nil for content type" do
expect { @fog_file.content_type&.size }.not_to raise_error
it "should not error getting the content type" do
expect { @fog_file.content_type }.not_to raise_error
end

it "should return false for content type" do
expect(@fog_file.content_type).not_to be false
end
end
end
Expand Down

0 comments on commit 0195c8c

Please sign in to comment.