spec/chef-vault/item_spec.rb in chef-vault-3.0.3 vs spec/chef-vault/item_spec.rb in chef-vault-3.1.0
- old
+ new
@@ -3,9 +3,14 @@
RSpec.describe ChefVault::Item do
subject(:item) { ChefVault::Item.new("foo", "bar") }
before do
item["foo"] = "bar"
+ http_response = double("http_response")
+ allow(http_response).to receive(:code).and_return("404")
+ non_existing = Net::HTTPServerException.new("http error message", http_response)
+
+ allow(Chef::DataBagItem).to receive(:load).with(anything, /_key_/).and_raise(non_existing)
end
describe "vault probe predicates" do
before do
# a normal data bag item