summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-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