summaryrefslogtreecommitdiff
path: root/spec/unit/provider
diff options
context:
space:
mode:
authorEric Saxby <sax@livinginthepast.org>2013-08-29 17:29:36 -0700
committerBryan McLellan <btm@opscode.com>2013-09-25 12:51:34 -0700
commit031bce02c29fd9a2811ad9b63692e1d880e35e84 (patch)
tree4b63a2de9a5deb1d65e3ea513fdeb1bf98b2b609 /spec/unit/provider
parent0a4cb24ef2b17a303c0949b824170c4d8a96857a (diff)
downloadchef-031bce02c29fd9a2811ad9b63692e1d880e35e84.tar.gz
[CHEF-4507] Smartos package provider to match resource package_name
Diffstat (limited to 'spec/unit/provider')
-rw-r--r--spec/unit/provider/package/smartos_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/unit/provider/package/smartos_spec.rb b/spec/unit/provider/package/smartos_spec.rb
index 47db00988c..71ea3fab04 100644
--- a/spec/unit/provider/package/smartos_spec.rb
+++ b/spec/unit/provider/package/smartos_spec.rb
@@ -69,6 +69,24 @@ describe Chef::Provider::Package::SmartOS, "load_current_resource" do
end
+ describe "candidate_version" do
+ it "should return the candidate_version variable if already setup" do
+ @provider.candidate_version = "2.1.1"
+ @provider.should_not_receive(:shell_out!)
+ @provider.candidate_version
+ end
+
+ it "should lookup the candidate_version if the variable is not already set" do
+ search = mock()
+ search.should_receive(:each_line).
+ and_yield("something-varnish-1.1.1 something varnish like\n").
+ and_yield("varnish-2.3.4 actual varnish\n")
+ @shell_out = mock('shell_out!', :stdout => search)
+ @provider.should_receive(:shell_out!).with('/opt/local/bin/pkgin se varnish', :env => nil, :returns => [0,1]).and_return(@shell_out)
+ @provider.candidate_version.should == "2.3.4"
+ end
+ end
+
describe "when manipulating a resource" do
it "run pkgin and install the package" do