diff options
author | Noah Kantrowitz <noah@coderanger.net> | 2016-03-02 17:50:27 -0800 |
---|---|---|
committer | Noah Kantrowitz <noah@coderanger.net> | 2016-03-02 17:50:27 -0800 |
commit | 8f5f95b90db1b9f5fc4a30a9e54ebfd81cce5177 (patch) | |
tree | 6de211e312bfa49eda72faeb641a4d347a2cd441 /spec | |
parent | a4d98365c1d68d7a24fba62783538951d2bbd2e0 (diff) | |
download | chef-8f5f95b90db1b9f5fc4a30a9e54ebfd81cce5177.tar.gz |
Clearer exception for loading non-existent data bag items in solo mode.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/data_bag_item_spec.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/spec/unit/data_bag_item_spec.rb b/spec/unit/data_bag_item_spec.rb index 7f7d2b3013..c5a4403283 100644 --- a/spec/unit/data_bag_item_spec.rb +++ b/spec/unit/data_bag_item_spec.rb @@ -325,6 +325,11 @@ describe Chef::DataBagItem do expect(item).to be_a_kind_of(Chef::DataBagItem) expect(item).to eq(data_bag_item) end + + it "raises an exception for unknown items" do + expect(Chef::DataBag).to receive(:load).with("users").and_return({ "charlie" => data_bag_item.to_hash }) + expect { Chef::DataBagItem.load("users", "wonka") }.to raise_error Chef::Exceptions::InvalidDataBagItemID + end end end end |