diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2014-09-03 14:22:53 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2014-09-08 11:10:06 -0700 |
commit | baaeb42c7ce190f7b386b478801c8809a63d0486 (patch) | |
tree | 3af922af66b9bc1d66bea608a215564d0bddd743 | |
parent | 00b3d151b7a03965575cb85944a39a152b5791ea (diff) | |
download | chef-baaeb42c7ce190f7b386b478801c8809a63d0486.tar.gz |
spec fixes for rpm package provider
-rw-r--r-- | spec/unit/provider/package/rpm_spec.rb | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/spec/unit/provider/package/rpm_spec.rb b/spec/unit/provider/package/rpm_spec.rb index 6e46cf5e98..9a96d829b8 100644 --- a/spec/unit/provider/package/rpm_spec.rb +++ b/spec/unit/provider/package/rpm_spec.rb @@ -102,25 +102,19 @@ describe Chef::Provider::Package::Rpm do describe "when installing or upgrading" do it "should run rpm -i with the package source to install" do - @provider.should_receive(:run_command_with_systems_locale).with({ - :command => "rpm -i /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm" - }) + @provider.should_receive(:shell_out!).with("rpm -i /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm") @provider.install_package("ImageMagick-c++", "6.5.4.7-7.el6_5") end it "should run rpm -U with the package source to upgrade" do @current_resource.version("21.4-19.el5") - @provider.should_receive(:run_command_with_systems_locale).with({ - :command => "rpm -U /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm" - }) + @provider.should_receive(:shell_out!).with("rpm -U /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm") @provider.upgrade_package("ImageMagick-c++", "6.5.4.7-7.el6_5") end it "should install package if missing and set to upgrade" do @current_resource.version("ImageMagick-c++") - @provider.should_receive(:run_command_with_systems_locale).with({ - :command => "rpm -U /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm" - }) + @provider.should_receive(:shell_out!).with("rpm -U /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm") @provider.upgrade_package("ImageMagick-c++", "6.5.4.7-7.el6_5") end @@ -130,9 +124,7 @@ describe Chef::Provider::Package::Rpm do @new_resource.source.should == "/tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm" @current_resource = Chef::Resource::Package.new("ImageMagick-c++") @provider.current_resource = @current_resource - @provider.should_receive(:run_command_with_systems_locale).with({ - :command => "rpm -i /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm" - }) + @provider.should_receive(:shell_out!).with("rpm -i /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm") @provider.install_package("/tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm", "6.5.4.7-7.el6_5") end @@ -143,30 +135,23 @@ describe Chef::Provider::Package::Rpm do @current_resource = Chef::Resource::Package.new("ImageMagick-c++") @current_resource.version("21.4-19.el5") @provider.current_resource = @current_resource - @provider.should_receive(:run_command_with_systems_locale).with({ - :command => "rpm -U /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm" - }) + @provider.should_receive(:shell_out!).with("rpm -U /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm") @provider.upgrade_package("/tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm", "6.5.4.7-7.el6_5") end it "installs with custom options specified in the resource" do @provider.candidate_version = '11' @new_resource.options("--dbpath /var/lib/rpm") - @provider.should_receive(:run_command_with_systems_locale).with({ - :command => "rpm --dbpath /var/lib/rpm -i /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm" - }) + @provider.should_receive(:shell_out!).with("rpm --dbpath /var/lib/rpm -i /tmp/ImageMagick-c++-6.5.4.7-7.el6_5.x86_64.rpm") @provider.install_package(@new_resource.name, @provider.candidate_version) end end describe "when removing the package" do it "should run rpm -e to remove the package" do - @provider.should_receive(:run_command_with_systems_locale).with({ - :command => "rpm -e ImageMagick-c++-6.5.4.7-7.el6_5" - }) + @provider.should_receive(:shell_out!).with("rpm -e ImageMagick-c++-6.5.4.7-7.el6_5") @provider.remove_package("ImageMagick-c++", "6.5.4.7-7.el6_5") end end end end - |