diff options
author | Prabhu Das <prabhu.das@clogeny.com> | 2013-07-30 14:29:04 +0530 |
---|---|---|
committer | adamedx <adamed@opscode.com> | 2013-08-19 22:56:45 -0700 |
commit | b2320499e270fd21f53a5d46b455836874616fd7 (patch) | |
tree | c4d4296c2b693f194a9fe254aca47b4b895d21c8 /spec/functional/resource/rpm_spec.rb | |
parent | f70de08ecb7f4f03f3c2260a93981308901a8337 (diff) | |
download | chef-b2320499e270fd21f53a5d46b455836874616fd7.tar.gz |
Refactored the before and after hooks to use linux commands instead of actions.
Diffstat (limited to 'spec/functional/resource/rpm_spec.rb')
-rw-r--r-- | spec/functional/resource/rpm_spec.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/spec/functional/resource/rpm_spec.rb b/spec/functional/resource/rpm_spec.rb index 312b66aa8b..46e5eae879 100644 --- a/spec/functional/resource/rpm_spec.rb +++ b/spec/functional/resource/rpm_spec.rb @@ -21,7 +21,7 @@ require 'chef/mixin/shell_out' # run this test only for following platforms. exclude_test = !['aix', 'centos', 'redhat', 'suse'].include?(ohai[:platform]) -describe Chef::Resource::RpmPackage, :requires_root ,:external => exclude_test do +describe Chef::Resource::RpmPackage, :requires_root, :external => exclude_test do include Chef::Mixin::ShellOut let(:new_resource) do @@ -57,10 +57,12 @@ describe Chef::Resource::RpmPackage, :requires_root ,:external => exclude_test d when "aix" FileUtils.cp 'spec/functional/assets/glib-1.2.10-2.aix4.3.ppc.rpm' , "/tmp/glib-1.2.10-2.aix4.3.ppc.rpm" @pkg_name = "glib" + @pkg_version = "1.2.10-2" @pkg_path = "/tmp/glib-1.2.10-2.aix4.3.ppc.rpm" when "centos", "redhat", "suse" FileUtils.cp 'spec/functional/assets/mytest-1.0-1.noarch.rpm' , "/tmp/mytest-1.0-1.noarch.rpm" @pkg_name = "mytest" + @pkg_version = "1.0-1" @pkg_path = "/tmp/mytest-1.0-1.noarch.rpm" end end @@ -76,13 +78,12 @@ describe Chef::Resource::RpmPackage, :requires_root ,:external => exclude_test d end after(:each) do - new_resource.run_action(:remove) + shell_out("rpm -qa | grep #{@pkg_name}-#{@pkg_version} | xargs rpm -e") end end - context "package remove action" do before(:each) do - new_resource.run_action(:install) + shell_out("rpm -i #{@pkg_path.sub(%r{^/tmp/}, "")}") end it "should remove an existing package" do |