summaryrefslogtreecommitdiff
path: root/spec/unit/provider/package/paludis_spec.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2014-10-24 18:12:50 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2014-10-24 18:12:50 -0700
commitbd0b0a34e4dbb60fe61bbc8716df90e8f7c7d19a (patch)
treeacc7a2d09b2cec8eed863218c0400cd15cd27854 /spec/unit/provider/package/paludis_spec.rb
parentbdce1c5619fde7d277262df9336e06f73e4fc3f8 (diff)
downloadchef-bd0b0a34e4dbb60fe61bbc8716df90e8f7c7d19a.tar.gz
updating resources/providers unit tests to rpsec3
mechanically generated patch using transpec 2.3.7 gem
Diffstat (limited to 'spec/unit/provider/package/paludis_spec.rb')
-rw-r--r--spec/unit/provider/package/paludis_spec.rb40
1 files changed, 20 insertions, 20 deletions
diff --git a/spec/unit/provider/package/paludis_spec.rb b/spec/unit/provider/package/paludis_spec.rb
index 8387bb1252..4ed5dfc003 100644
--- a/spec/unit/provider/package/paludis_spec.rb
+++ b/spec/unit/provider/package/paludis_spec.rb
@@ -28,7 +28,7 @@ describe Chef::Provider::Package::Paludis do
@run_context = Chef::RunContext.new(@node, {}, @events)
@new_resource = Chef::Resource::Package.new("net/ntp")
@current_resource = Chef::Resource::Package.new("net/ntp")
- Chef::Resource::Package.stub(:new).and_return(@current_resource)
+ allow(Chef::Resource::Package).to receive(:new).and_return(@current_resource)
@provider = Chef::Provider::Package::Paludis.new(@new_resource, @run_context)
@stdin = StringIO.new
@@ -47,19 +47,19 @@ PKG_STATUS
context "when loading current resource" do
it "should create a current resource with the name of the new_resource" do
- @provider.should_receive(:shell_out!).and_return(@shell_out)
- Chef::Resource::Package.should_receive(:new).and_return(@current_resource)
+ expect(@provider).to receive(:shell_out!).and_return(@shell_out)
+ expect(Chef::Resource::Package).to receive(:new).and_return(@current_resource)
@provider.load_current_resource
end
it "should set the current resources package name to the new resources package name" do
- @provider.should_receive(:shell_out!).and_return(@shell_out)
- @current_resource.should_receive(:package_name).with(@new_resource.package_name)
+ expect(@provider).to receive(:shell_out!).and_return(@shell_out)
+ expect(@current_resource).to receive(:package_name).with(@new_resource.package_name)
@provider.load_current_resource
end
it "should run pkg info with the package name" do
- @provider.should_receive(:shell_out!).with("cave -L warning print-ids -M none -m \"#{@new_resource.package_name}\" -f \"%c/%p %v %r\n\"").and_return(@shell_out)
+ expect(@provider).to receive(:shell_out!).with("cave -L warning print-ids -M none -m \"#{@new_resource.package_name}\" -f \"%c/%p %v %r\n\"").and_return(@shell_out)
@provider.load_current_resource
end
@@ -72,28 +72,28 @@ user/ntp 0 accounts
user/ntp 0 installed-accounts
net/ntp 4.2.6_p5-r1 installed
INSTALLED
- @provider.should_receive(:shell_out!).and_return(@shell_out)
+ expect(@provider).to receive(:shell_out!).and_return(@shell_out)
@provider.load_current_resource
- @current_resource.version.should == "4.2.6_p5-r1"
- @provider.candidate_version.should eql("4.2.6_p5-r2")
+ expect(@current_resource.version).to eq("4.2.6_p5-r1")
+ expect(@provider.candidate_version).to eql("4.2.6_p5-r2")
end
it "should return the current resource" do
- @provider.should_receive(:shell_out!).and_return(@shell_out)
- @provider.load_current_resource.should eql(@current_resource)
+ expect(@provider).to receive(:shell_out!).and_return(@shell_out)
+ expect(@provider.load_current_resource).to eql(@current_resource)
end
end
context "when installing a package" do
it "should run pkg install with the package name and version" do
- @provider.should_receive(:shell_out!).with("cave -L warning resolve -x \"=net/ntp-4.2.6_p5-r2\"", {:timeout=>@new_resource.timeout})
+ expect(@provider).to receive(:shell_out!).with("cave -L warning resolve -x \"=net/ntp-4.2.6_p5-r2\"", {:timeout=>@new_resource.timeout})
@provider.install_package("net/ntp", "4.2.6_p5-r2")
end
it "should run pkg install with the package name and version and options if specified" do
- @provider.should_receive(:shell_out!).with("cave -L warning resolve -x --preserve-world \"=net/ntp-4.2.6_p5-r2\"", {:timeout=>@new_resource.timeout})
- @new_resource.stub(:options).and_return("--preserve-world")
+ expect(@provider).to receive(:shell_out!).with("cave -L warning resolve -x --preserve-world \"=net/ntp-4.2.6_p5-r2\"", {:timeout=>@new_resource.timeout})
+ allow(@new_resource).to receive(:options).and_return("--preserve-world")
@provider.install_package("net/ntp", "4.2.6_p5-r2")
end
@@ -102,7 +102,7 @@ INSTALLED
sys-process/lsof 4.87 arbor
sys-process/lsof 4.87 x86_64
PKG_STATUS
- @provider.should_receive(:shell_out!).with("cave -L warning resolve -x \"=sys-process/lsof-4.87\"", {:timeout=>@new_resource.timeout})
+ expect(@provider).to receive(:shell_out!).with("cave -L warning resolve -x \"=sys-process/lsof-4.87\"", {:timeout=>@new_resource.timeout})
@provider.install_package("sys-process/lsof", "4.87")
end
@@ -111,23 +111,23 @@ PKG_STATUS
sys-process/lsof 4.87 arbor
sys-process/lsof 4.87 x86_64
PKG_STATUS
- @provider.should_receive(:shell_out!).and_return(@shell_out)
+ expect(@provider).to receive(:shell_out!).and_return(@shell_out)
@provider.load_current_resource
- @current_resource.version.should be_nil
- @provider.candidate_version.should eql("4.87")
+ expect(@current_resource.version).to be_nil
+ expect(@provider.candidate_version).to eql("4.87")
end
end
context "when upgrading a package" do
it "should run pkg install with the package name and version" do
- @provider.should_receive(:shell_out!).with("cave -L warning resolve -x \"=net/ntp-4.2.6_p5-r2\"", {:timeout=>@new_resource.timeout})
+ expect(@provider).to receive(:shell_out!).with("cave -L warning resolve -x \"=net/ntp-4.2.6_p5-r2\"", {:timeout=>@new_resource.timeout})
@provider.upgrade_package("net/ntp", "4.2.6_p5-r2")
end
end
context "when uninstalling a package" do
it "should run pkg uninstall with the package name and version" do
- @provider.should_receive(:shell_out!).with("cave -L warning uninstall -x \"=net/ntp-4.2.6_p5-r2\"")
+ expect(@provider).to receive(:shell_out!).with("cave -L warning uninstall -x \"=net/ntp-4.2.6_p5-r2\"")
@provider.remove_package("net/ntp", "4.2.6_p5-r2")
end