Commit d591a648 by Mike Burns

Fix the formatting.

parent 5ec9a737
......@@ -119,16 +119,16 @@ module Paperclip
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 @@ module Paperclip
raise ArgumentError, "Credentials are not a path, file, or hash."
end
end
def connection
@connection ||= ::Fog::Storage.new(@fog_credentials)
end
......
......@@ -5,7 +5,7 @@ Fog.mock!
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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment