Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix the formatting.

  • Loading branch information...
commit d591a64862444e4c83932019be1267c6ec8acfe1 1 parent 5ec9a73
@mike-burns mike-burns authored
Showing with 11 additions and 12 deletions.
  1. +5 −5 lib/paperclip/storage/fog.rb
  2. +6 −7 test/fog_test.rb
View
10 lib/paperclip/storage/fog.rb
@@ -119,16 +119,16 @@ def public_url(style = default_style)
directory.files.new(:key => path(style)).public_url
end
end
-
- def parse_credentials creds
+
+ def parse_credentials(creds)
creds = find_credentials(creds).stringify_keys
env = Object.const_defined?(:Rails) ? Rails.env : nil
(creds[env] || creds).symbolize_keys
end
private
-
- def find_credentials creds
+
+ def find_credentials(creds)
case creds
when File
YAML::load(ERB.new(File.read(creds.path)).result)
@@ -140,7 +140,7 @@ def find_credentials creds
raise ArgumentError, "Credentials are not a path, file, or hash."
end
end
-
+
def connection
@connection ||= ::Fog::Storage.new(@fog_credentials)
end
View
13 test/fog_test.rb
@@ -5,7 +5,7 @@
class FogTest < Test::Unit::TestCase
context "" do
-
+
context "with credentials provided in a path string" do
setup do
rebuild_model :styles => { :medium => "300x300>", :thumb => "100x100>" },
@@ -21,7 +21,7 @@ class FogTest < Test::Unit::TestCase
assert_equal @dummy.avatar.instance_variable_get("@fog_credentials")[:provider], 'AWS'
end
end
-
+
context "with credentials provided in a File object" do
setup do
rebuild_model :styles => { :medium => "300x300>", :thumb => "100x100>" },
@@ -37,8 +37,7 @@ class FogTest < Test::Unit::TestCase
assert_equal @dummy.avatar.instance_variable_get("@fog_credentials")[:provider], 'AWS'
end
end
-
-
+
context "with default values for path and url" do
setup do
rebuild_model :styles => { :medium => "300x300>", :thumb => "100x100>" },
@@ -59,7 +58,7 @@ class FogTest < Test::Unit::TestCase
@dummy.avatar.path
end
end
-
+
setup do
@fog_directory = 'papercliptests'
@@ -165,7 +164,7 @@ class FogTest < Test::Unit::TestCase
assert @dummy.avatar.url =~ /^http:\/\/img[0123]\.example\.com\/avatars\/stringio\.txt\?\d*$/
end
end
-
+
context "with fog_public set to false" do
setup do
rebuild_model(@options.merge(:fog_public => false))
@@ -173,7 +172,7 @@ class FogTest < Test::Unit::TestCase
@dummy.avatar = StringIO.new('.')
@dummy.save
end
-
+
should 'set the @fog_public instance variable to false' do
assert_equal false, @dummy.avatar.instance_variable_get('@fog_public')
end

0 comments on commit d591a64

Please sign in to comment.
Something went wrong with that request. Please try again.