diff --git a/lib/fog/rackspace/storage.rb b/lib/fog/rackspace/storage.rb index 7496b5ac4..dec87ef05 100644 --- a/lib/fog/rackspace/storage.rb +++ b/lib/fog/rackspace/storage.rb @@ -77,6 +77,7 @@ module Fog require 'mime/types' @rackspace_api_key = options[:rackspace_api_key] @rackspace_username = options[:rackspace_username] + @rackspace_cdn_ssl = options[:rackspace_cdn_ssl] end def data @@ -95,6 +96,10 @@ module Fog @rackspace_region end + def ssl? + !!@rackspace_cdn_ssl + end + end class Real < Fog::Rackspace::Service @@ -134,7 +139,7 @@ module Fog # @return [Boolean] return true if service is returning SSL-Secured URLs in public_url methods # @see Directory#public_url def ssl? - !rackspace_cdn_ssl.nil? + !!rackspace_cdn_ssl end # Resets presistent service connections diff --git a/tests/rackspace/storage_tests.rb b/tests/rackspace/storage_tests.rb index fc3dc6b16..4c4fb9276 100644 --- a/tests/rackspace/storage_tests.rb +++ b/tests/rackspace/storage_tests.rb @@ -112,5 +112,19 @@ Shindo.tests('Rackspace | Storage', ['rackspace']) do pending if Fog.mocking? Fog::Storage[:rackspace].account end + + tests('ssl') do + tests('ssl enabled') do + @service = Fog::Storage::Rackspace.new(:rackspace_cdn_ssl => true) + returns(true) { @service.ssl? } + end + tests('ssl disabled') do + @service = Fog::Storage::Rackspace.new(:rackspace_cdn_ssl => false) + returns(false) { @service.ssl? } + + @service = Fog::Storage::Rackspace.new(:rackspace_cdn_ssl => nil) + returns(false) { @service.ssl? } + end + end end