summaryrefslogtreecommitdiff
path: root/spec/unit/node
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/node')
-rw-r--r--spec/unit/node/attribute_spec.rb32
-rw-r--r--spec/unit/node/immutable_collections_spec.rb16
2 files changed, 24 insertions, 24 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
diff --git a/spec/unit/node/immutable_collections_spec.rb b/spec/unit/node/immutable_collections_spec.rb
index 73165c1fba..07176beb76 100644
--- a/spec/unit/node/immutable_collections_spec.rb
+++ b/spec/unit/node/immutable_collections_spec.rb
@@ -16,7 +16,7 @@
# limitations under the License.
#
-require 'spec_helper'
+require "spec_helper"
require "chef/node/immutable_collections"
describe Chef::Node::ImmutableMash do
@@ -64,19 +64,19 @@ describe Chef::Node::ImmutableMash do
end
it "converts an immutable nested mash to a new mutable hash" do
- expect(@copy['top_level_4']['level2']).to be_instance_of(Hash)
+ expect(@copy["top_level_4"]["level2"]).to be_instance_of(Hash)
end
it "converts an immutable nested array to a new mutable array" do
- expect(@copy['top_level_2']).to be_instance_of(Array)
+ expect(@copy["top_level_2"]).to be_instance_of(Array)
end
it "should create a mash with the same content" do
expect(@copy).to eq(@immutable_mash)
end
- it 'should allow mutation' do
- expect { @copy['m'] = 'm' }.not_to raise_error
+ it "should allow mutation" do
+ expect { @copy["m"] = "m" }.not_to raise_error
end
end
@@ -113,7 +113,7 @@ describe Chef::Node::ImmutableArray do
before do
@immutable_array = Chef::Node::ImmutableArray.new(%w[foo bar baz] + Array(1..3) + [nil, true, false, [ "el", 0, nil ] ])
- immutable_mash = Chef::Node::ImmutableMash.new({:m => 'm'})
+ immutable_mash = Chef::Node::ImmutableMash.new({:m => "m"})
@immutable_nested_array = Chef::Node::ImmutableArray.new(["level1",@immutable_array, immutable_mash])
end
@@ -189,8 +189,8 @@ describe Chef::Node::ImmutableArray do
expect(@copy).to eq(@immutable_nested_array)
end
- it 'should allow mutation' do
- expect { @copy << 'm' }.not_to raise_error
+ it "should allow mutation" do
+ expect { @copy << "m" }.not_to raise_error
end
end