Commit 7c78aa32 by David Faber Committed by Alex Godin

Fix bug that prevents you from assigning "false" to the :fog_public attachment option

parent 9f389280
......@@ -44,7 +44,7 @@ module Paperclip
@fog_directory = @options[:fog_directory]
@fog_credentials = @options[:fog_credentials]
@fog_host = @options[:fog_host]
@fog_public = @options[:fog_public] || true
@fog_public = @options.key?(:fog_public) ? @options[:fog_public] : true
@fog_file = @options[:fog_file] || {}
@url = ':fog_public_url'
......
......@@ -111,6 +111,19 @@ 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))
@dummy = Dummy.new
@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
end
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