Permalink
Browse files

Added #extension to CarrierWave::Storage::Fog::File.

  • Loading branch information...
1 parent 6babc37 commit 35c3b006c98f86dc99f36b4cde6974a34917c29f Robbie Pitts committed Dec 6, 2012
Showing with 15 additions and 0 deletions.
  1. +11 −0 lib/carrierwave/storage/fog.rb
  2. +4 −0 spec/storage/fog_helper.rb
@@ -194,6 +194,17 @@ def delete
# avoid a get by just using local reference
directory.files.new(:key => path).destroy
end
+
+ ##
+ # Return extension of file
+ #
+ # === Returns
+ #
+ # [String] extension of file
+ #
+ def extension
+ path.split('.').last
+ end
##
# deprecated: All attributes from file (includes headers)
@@ -56,6 +56,10 @@ class FogSpec#{fog_credentials[:provider]}Uploader < CarrierWave::Uploader::Base
@fog_file.content_type.should == 'image/jpeg'
@directory.files.get('uploads/test.jpg').content_type.should == 'image/jpeg'
end
+
+ it "should have an extension" do
+ @fog_file.extension.should == "jpg"
+ end
context "without asset_host" do
it "should have a public_url" do

0 comments on commit 35c3b00

Please sign in to comment.