diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2019-11-08 14:06:33 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2019-11-08 14:06:33 -0800 |
commit | 8a7e29d52882c39d0c903eef83bd3472e4f334af (patch) | |
tree | a25a7b76416e07ebdb54e569fb0006079cf012db /spec/unit/mash_spec.rb | |
parent | c31625406530b560fab02b11fa2447955ed2faef (diff) | |
download | chef-8a7e29d52882c39d0c903eef83bd3472e4f334af.tar.gz |
Add chef-utils gem with various recipe DSL helpers
This is the implementation of [RFC-087](https://github.com/chef-boneyard/chef-rfc/blob/master/rfc087-distro-sugar-helpers.md)
although some of the specifics have been iterated on and changed.
The documentation will be in the [README.md](https://github.com/chef/chef/tree/master/chef-utils/README.md) once this is merged.
While this PR mostly moves chef-sugar utilities into core-chef via this chef-utils gem, the scope of the chef-utils gem
should be considered larger than just that. As an example this PR moves the Mash class into this gem for reuse in ohai
as well.
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec/unit/mash_spec.rb')
-rw-r--r-- | spec/unit/mash_spec.rb | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/spec/unit/mash_spec.rb b/spec/unit/mash_spec.rb deleted file mode 100644 index 0797e80f2c..0000000000 --- a/spec/unit/mash_spec.rb +++ /dev/null @@ -1,51 +0,0 @@ -# -# Author:: Matthew Kent (<mkent@magoazul.com>) -# Copyright:: Copyright 2011-2016, Chef Software Inc. -# License:: Apache License, Version 2.0 -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -require "spec_helper" -require "chef/mash" - -describe Mash do - it "should duplicate a simple key/value mash to a new mash" do - data = { x: "one", y: "two", z: "three" } - @orig = Mash.new(data) - @copy = @orig.dup - expect(@copy.to_hash).to eq(Mash.new(data).to_hash) - @copy[:x] = "four" - expect(@orig[:x]).to eq("one") - end - - it "should duplicate a mash with an array to a new mash" do - data = { x: "one", y: "two", z: [1, 2, 3] } - @orig = Mash.new(data) - @copy = @orig.dup - expect(@copy.to_hash).to eq(Mash.new(data).to_hash) - @copy[:z] << 4 - expect(@orig[:z]).to eq([1, 2, 3]) - end - - it "should duplicate a nested mash to a new mash" do - data = { x: "one", y: "two", z: Mash.new({ a: [1, 2, 3] }) } - @orig = Mash.new(data) - @copy = @orig.dup - expect(@copy.to_hash).to eq(Mash.new(data).to_hash) - @copy[:z][:a] << 4 - expect(@orig[:z][:a]).to eq([1, 2, 3]) - end - - # add more! -end |