diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2015-08-13 12:54:43 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2015-08-20 00:18:58 -0700 |
commit | 42582687f5a9e3f766e6f016e43db4477010a56e (patch) | |
tree | a54a3644dada424f3fc25fa84efdf70e20990662 /spec/unit/provider | |
parent | b3b4c0766c2ec8a5cb6cb3551ebb4693a07b2dfd (diff) | |
download | chef-42582687f5a9e3f766e6f016e43db4477010a56e.tar.gz |
add a test for the new provider behavior
Diffstat (limited to 'spec/unit/provider')
-rw-r--r-- | spec/unit/provider/package/yum_spec.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/spec/unit/provider/package/yum_spec.rb b/spec/unit/provider/package/yum_spec.rb index c03c99ecec..fa8751bacc 100644 --- a/spec/unit/provider/package/yum_spec.rb +++ b/spec/unit/provider/package/yum_spec.rb @@ -24,7 +24,7 @@ describe Chef::Provider::Package::Yum do @node = Chef::Node.new @events = Chef::EventDispatch::Dispatcher.new @run_context = Chef::RunContext.new(@node, {}, @events) - @new_resource = Chef::Resource::Package.new('cups') + @new_resource = Chef::Resource::YumPackage.new('cups') @status = double("Status", :exitstatus => 0) @yum_cache = double( 'Chef::Provider::Yum::YumCache', @@ -790,6 +790,19 @@ describe Chef::Provider::Package::Yum do # will still raise an exception, can't stub out the subsequent call expect { @provider.yum_command("-d0 -e0 -y install emacs-1.0") }.to raise_error(Chef::Exceptions::Exec) end + + it "should pass the yum_binary to the command if its specified" do + @new_resource.yum_binary "yum-deprecated" + expect(@yum_cache).to receive(:yum_binary=).with("yum-deprecated") + @provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context) + @status = double("Status", :exitstatus => 0, :stdout => "", :stderr => "") + allow(@provider).to receive(:shell_out).and_return(@status) + expect(@provider).to receive(:shell_out).once.with( + "yum-deprecated -d0 -e0 -y install emacs-1.0", + {:timeout => Chef::Config[:yum_timeout]} + ) + @provider.yum_command("-d0 -e0 -y install emacs-1.0") + end end end |