summaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
authorNoah Kantrowitz <noah@coderanger.net>2016-03-03 09:23:42 -0800
committerNoah Kantrowitz <noah@coderanger.net>2016-03-03 09:23:42 -0800
commit5979a39fbbb3640283eb81c8bce68ac2b509783c (patch)
tree1a890b04d2f21e8145eea60f753b2e433a6c79fe /spec/unit
parent383e681013bdd188f208753f9be60b4b9580aa52 (diff)
parent8f5f95b90db1b9f5fc4a30a9e54ebfd81cce5177 (diff)
downloadchef-5979a39fbbb3640283eb81c8bce68ac2b509783c.tar.gz
Merge pull request #4655 from coderanger/solobag
Clearer exception for loading non-existent data bag items in solo mode.
Diffstat (limited to 'spec/unit')
-rw-r--r--spec/unit/data_bag_item_spec.rb5
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