diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-04-17 17:05:43 -0700 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-04-17 17:05:43 -0700 |
commit | c25eb20b2b1e4676118d7583b7f17394c9deec41 (patch) | |
tree | dbab2a32f38bed37b38c3a11df620ae4743a339e /spec | |
parent | 0cf9f8817e5b493cf93949b69a580dd45b39e021 (diff) | |
download | chef-c25eb20b2b1e4676118d7583b7f17394c9deec41.tar.gz |
Use lamont's magic error handling
Tiny tweak to grab the first item so we actually get the hash back in the error handling.
Given:
```ruby
package %w{curl totally_junk_pkg} do
action :upgrade
end
```
```
* No candidate version available for totally_junk_pkg
================================================================================
Error executing action `upgrade` on resource 'homebrew_package[curl, totally_junk_pkg]'
================================================================================
Chef::Exceptions::Package
-------------------------
No candidate version available for totally_junk_pkg
```
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/provider/package/homebrew_spec.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/spec/unit/provider/package/homebrew_spec.rb b/spec/unit/provider/package/homebrew_spec.rb index 62d8aee6f1..9975e72b02 100644 --- a/spec/unit/provider/package/homebrew_spec.rb +++ b/spec/unit/provider/package/homebrew_spec.rb @@ -238,9 +238,10 @@ describe Chef::Provider::Package::Homebrew do expect(provider.brew_info).to have_key("vim") end - it "returns empty hash if brew_cmd_output_data returned empty stdout" do + it "returns empty hash for packages if they lack data" do + new_resource.package_name %w{bogus} allow(provider).to receive(:brew_cmd_output).and_return("") - expect(provider.brew_info).to eq({}) + expect(provider.brew_info).to eq("bogus" => {}) end end |