diff --git a/lib/fog/core/attributes.rb b/lib/fog/core/attributes.rb index a7dcd0360..cab8d6f52 100644 --- a/lib/fog/core/attributes.rb +++ b/lib/fog/core/attributes.rb @@ -71,8 +71,10 @@ module Fog class_eval <<-EOS, __FILE__, __LINE__ def #{name}=(new_data) if new_data.is_a?(Hash) - if new_data[:#{squash}] || new_data["#{squash}"] - attributes[:#{name}] = new_data[:#{squash}] || new_data["#{squash}"] + if new_data.has_key?(:#{squash}) + attributes[:#{name}] = new_data[:#{squash}] + elsif new_data.has_key?("#{squash}") + attributes[:#{name}] = new_data["#{squash}"] else attributes[:#{name}] = [ new_data ] end diff --git a/tests/core/attribute_tests.rb b/tests/core/attribute_tests.rb index c3122ec0a..2b26c72a9 100644 --- a/tests/core/attribute_tests.rb +++ b/tests/core/attribute_tests.rb @@ -19,6 +19,15 @@ Shindo.tests('Fog::Attributes', 'core') do @model.key end + tests('"keys" => {"id" => false}').returns(false) do + @model.merge_attributes("keys" => {'id' => false }) + @model.key + end + + tests('"keys" => {:id => false}').returns(false) do + @model.merge_attributes("keys" => {:id => false }) + @model.key + end end tests(':type => :time') do @@ -42,4 +51,4 @@ Shindo.tests('Fog::Attributes', 'core') do end -end \ No newline at end of file +end