diff options
author | Jeremy J. Miller <jm@chef.io> | 2018-05-16 07:50:39 -0400 |
---|---|---|
committer | Jeremy J. Miller <jm@chef.io> | 2018-05-16 07:50:39 -0400 |
commit | ca3be72bd1f2b393dd2e70ed4620549d449b1559 (patch) | |
tree | e79ef868edaec017b61175239c5b6feb1dcd6179 /spec/unit/chef_fs | |
parent | 7acbb49f913e7064e8736b0e56eff8ecf5acf10a (diff) | |
download | chef-ca3be72bd1f2b393dd2e70ed4620549d449b1559.tar.gz |
added one more rspec test
Signed-off-by: Jeremy J. Miller <jm@chef.io>
Diffstat (limited to 'spec/unit/chef_fs')
-rw-r--r-- | spec/unit/chef_fs/data_handler/data_handler_base_spec.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/spec/unit/chef_fs/data_handler/data_handler_base_spec.rb b/spec/unit/chef_fs/data_handler/data_handler_base_spec.rb index 2df468aca5..8f300b1dd0 100644 --- a/spec/unit/chef_fs/data_handler/data_handler_base_spec.rb +++ b/spec/unit/chef_fs/data_handler/data_handler_base_spec.rb @@ -24,14 +24,16 @@ describe Chef::ChefFS::DataHandler::DataHandlerBase do let(:some_item) do { "name" => "grizzly", "gender" => "female", - "age" => 3 + "age" => 3, + "food" => "honey" } end let(:item_defaults) do { "family" => "ursidae", "hibernate" => true, - "avg_lifespan_years" => 22, + "food" => "berries", + "avg_lifespan_years" => 22 } end @@ -41,16 +43,21 @@ describe Chef::ChefFS::DataHandler::DataHandlerBase do "family" => "ursidae", "hibernate" => true, "avg_lifespan_years" => 22, - "age" => 3 + "age" => 3, + "food" => "honey" } end let(:handler) { described_class.new } - it "normalizes the Hash, filling in defaults" do + it "normalizes the Hash, filling in default values" do expect(handler.normalize_hash(some_item, item_defaults)).to eq(normalized) end + it "prefers already existing values over default values" do + expect(handler.normalize_hash(some_item, item_defaults)['food']).to eq("honey") + end + it "handles being passed a nil value instead of Hash" do expect(handler.normalize_hash(nil, item_defaults)).to eq(item_defaults) end |