Commit 75a8bd20 by Brian Morearty Committed by Jon Yurek

Default fog_public option to true *again* (as stated in documentation).

This was previously fixed in pull request #539 but no spec was added at that time, and it has since been broken.

I fixed it and added a spec.
parent 9bfcebc8
......@@ -70,14 +70,14 @@ module Paperclip
end
def fog_public(style = default_style)
if defined?(@options[:fog_public])
if defined?(@options[:fog_public][style])
return @options[:fog_public][style]
if @options.has_key?(:fog_public)
if @options[:fog_public].respond_to?(:has_key?) && @options[:fog_public].has_key?(style)
@options[:fog_public][style]
else
return @options[:fog_public]
@options[:fog_public]
end
else
return true
true
end
end
......
......@@ -252,7 +252,7 @@ class FogTest < Test::Unit::TestCase
@dummy.save
end
should 'set the @fog_public for a perticular style to false' do
should 'set the @fog_public for a particular style to false' do
assert_equal false, @dummy.avatar.instance_variable_get('@options')[:fog_public]
assert_equal false, @dummy.avatar.fog_public(:thumb)
end
......@@ -267,12 +267,25 @@ class FogTest < Test::Unit::TestCase
@dummy.save
end
should 'set the fog_public for a perticular style to correct value' do
should 'set the fog_public for a particular style to correct value' do
assert_equal false, @dummy.avatar.fog_public(:medium)
assert_equal true, @dummy.avatar.fog_public(:thumb)
end
end
context "with fog_public not set" do
setup do
rebuild_model(@options)
@dummy = Dummy.new
@dummy.avatar = StringIO.new('.')
@dummy.save
end
should "default fog_public to true" do
assert_equal true, @dummy.avatar.fog_public
end
end
context "with a valid bucket name for a subdomain" do
should "provide an url in subdomain style" do
assert_match @dummy.avatar.url, /^https:\/\/papercliptests.s3.amazonaws.com\/avatars\/5k.png/
......
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