diff options
author | Xabier de Zuazo <xabier@onddo.com> | 2014-03-18 09:42:00 +0100 |
---|---|---|
committer | Bryan McLellan <btm@getchef.com> | 2014-03-28 16:38:44 -0700 |
commit | 04f0861ce68ec31b45c6079deddb96b7dabd2e8b (patch) | |
tree | 463d734d538c76c95e4cb19c5233b8742254dfc6 /spec/unit/node | |
parent | b741b87b81f82587800da5329b47cfd414b3301d (diff) | |
download | chef-04f0861ce68ec31b45c6079deddb96b7dabd2e8b.tar.gz |
[CHEF-5132] ImmutableCollections #to_a and #to_hash tests changed to use #be_instance_of and cleaned
Diffstat (limited to 'spec/unit/node')
-rw-r--r-- | spec/unit/node/immutable_collections_spec.rb | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/spec/unit/node/immutable_collections_spec.rb b/spec/unit/node/immutable_collections_spec.rb index b690beb4c5..a11f33f93b 100644 --- a/spec/unit/node/immutable_collections_spec.rb +++ b/spec/unit/node/immutable_collections_spec.rb @@ -54,17 +54,16 @@ describe Chef::Node::ImmutableMash do @immutable_mash[:top_level_4][:level2].should be_a(Chef::Node::ImmutableMash) end - it "converts an immutable nested mash to a new mutable hash" do - orig = Mash.new(@data_in) - copy = orig.dup - copy = copy.to_hash - copy.should be_a(Hash) - copy['top_level_4']['level2'].should be_a(Hash) - copy.should == orig - copy['top_level_4']['level2'] = "A different value." - copy.should_not == orig - end + describe "to_hash" do + it "converts an immutable nested mash to a new mutable hash" do + copy = @immutable_mash.to_hash + copy.should be_instance_of(Hash) + copy['top_level_4']['level2'].should be_instance_of(Hash) + copy.should == @immutable_mash + end + + end [ :[]=, @@ -152,15 +151,16 @@ describe Chef::Node::ImmutableArray do mutable[0].should == :value end - it "converts an immutable nested array to a new mutable array" do - copy = @immutable_nested_array.dup - copy = copy.to_a - copy.should be_a(Array) - copy[1].should be_a(Array) - copy.should == @immutable_nested_array - copy[0] = "A different value." - copy.should_not == @immutable_nested_array - end + describe "to_a" do + + it "converts an immutable nested array to a new mutable array" do + copy = @immutable_nested_array.to_a + copy.should be_instance_of(Array) + copy[1].should be_instance_of(Array) + copy.should == @immutable_nested_array + end + + end end |