diff options
Diffstat (limited to 'spec/unit/node/attribute_spec.rb')
-rw-r--r-- | spec/unit/node/attribute_spec.rb | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/spec/unit/node/attribute_spec.rb b/spec/unit/node/attribute_spec.rb index 9956ef1ec9..dfa6f33122 100644 --- a/spec/unit/node/attribute_spec.rb +++ b/spec/unit/node/attribute_spec.rb @@ -17,8 +17,8 @@ # limitations under the License. # -require 'spec_helper' -require 'chef/node/attribute' +require "spec_helper" +require "chef/node/attribute" describe Chef::Node::Attribute do before(:each) do @@ -488,31 +488,31 @@ describe Chef::Node::Attribute do end it "should create a deep copy of the node attribute" do - @attributes.default['foo']['bar']['baz'] = 'fizz' - hash = @attributes['foo'].to_hash + @attributes.default["foo"]["bar"]["baz"] = "fizz" + hash = @attributes["foo"].to_hash expect(hash).to eql({"bar"=>{"baz"=>"fizz"}}) - hash['bar']['baz'] = 'buzz' + hash["bar"]["baz"] = "buzz" expect(hash).to eql({"bar"=>{"baz"=>"buzz"}}) - expect(@attributes.default['foo']).to eql({"bar"=>{"baz"=>"fizz"}}) + expect(@attributes.default["foo"]).to eql({"bar"=>{"baz"=>"fizz"}}) end it "should create a deep copy of arrays in the node attribute" do - @attributes.default['foo']['bar'] = ['fizz'] - hash = @attributes['foo'].to_hash - expect(hash).to eql({"bar"=>[ 'fizz' ]}) - hash['bar'].push('buzz') - expect(hash).to eql({"bar"=>[ 'fizz', 'buzz' ]}) - expect(@attributes.default['foo']).to eql({"bar"=>[ 'fizz' ]}) + @attributes.default["foo"]["bar"] = ["fizz"] + hash = @attributes["foo"].to_hash + expect(hash).to eql({"bar"=>[ "fizz" ]}) + hash["bar"].push("buzz") + expect(hash).to eql({"bar"=>[ "fizz", "buzz" ]}) + expect(@attributes.default["foo"]).to eql({"bar"=>[ "fizz" ]}) end it "mutating strings should not mutate the attributes" do pending "this is a bug that should be fixed" - @attributes.default['foo']['bar']['baz'] = 'fizz' - hash = @attributes['foo'].to_hash + @attributes.default["foo"]["bar"]["baz"] = "fizz" + hash = @attributes["foo"].to_hash expect(hash).to eql({"bar"=>{"baz"=>"fizz"}}) - hash['bar']['baz'] << 'buzz' + hash["bar"]["baz"] << "buzz" expect(hash).to eql({"bar"=>{"baz"=>"fizzbuzz"}}) - expect(@attributes.default['foo']).to eql({"bar"=>{"baz"=>"fizz"}}) + expect(@attributes.default["foo"]).to eql({"bar"=>{"baz"=>"fizz"}}) end end |