summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjtimberman <joshua@opscode.com>2012-08-15 08:58:46 -0600
committerBryan McLellan <btm@opscode.com>2012-08-20 12:44:39 -0700
commit125be01063351511bc9c2a1f93623dad41c5fb10 (patch)
treeae3a927a14e5e26bcaa8ef2b78d1dd47a374fa95
parent3a10322db30490d2c67ecaa1f68a37a4e4a685a5 (diff)
downloadchef-125be01063351511bc9c2a1f93623dad41c5fb10.tar.gz
[CHEF-3360] - Add unit test
* Test fails properly w/o the earlier commit * Test passes properly w/ the earlier commit Conflicts: chef/spec/unit/provider/package/ips_spec.rb
-rw-r--r--chef/spec/unit/provider/package/ips_spec.rb42
1 files changed, 40 insertions, 2 deletions
diff --git a/chef/spec/unit/provider/package/ips_spec.rb b/chef/spec/unit/provider/package/ips_spec.rb
index a92805bdbb..dad880a93b 100644
--- a/chef/spec/unit/provider/package/ips_spec.rb
+++ b/chef/spec/unit/provider/package/ips_spec.rb
@@ -45,7 +45,7 @@ describe Chef::Provider::Package::Ips do
Version: 2.0.17
Build Release: 5.11
Branch: 0.175.0.0.0.2.537
-Packaging Date: October 19, 2011 09:14:50 AM
+Packaging Date: October 19, 2011 09:14:50 AM
Size: 8.07 MB
FMRI: pkg://solaris/crypto/gnupg@2.0.17,5.11-0.175.0.0.0.2.537:20111019T091450Z
PKG_STATUS
@@ -89,7 +89,7 @@ PKG_STATUS
Version: 2.0.17
Build Release: 5.11
Branch: 0.175.0.0.0.2.537
-Packaging Date: October 19, 2011 09:14:50 AM
+Packaging Date: October 19, 2011 09:14:50 AM
Size: 8.07 MB
FMRI: pkg://solaris/crypto/gnupg@2.0.17,5.11-0.175.0.0.0.2.537:20111019T091450Z
INSTALLED
@@ -122,6 +122,44 @@ INSTALLED
@provider.install_package("crypto/gnupg", "2.0.17")
end
+ it "should not contain invalid characters for the version string" do
+ @stdout.replace(<<-PKG_STATUS)
+ Name: security/sudo
+ Summary: sudo - authority delegation tool
+ State: Not Installed
+ Publisher: omnios
+ Version: 1.8.4.1 (1.8.4p1)
+ Build Release: 5.11
+ Branch: 0.151002
+Packaging Date: April 1, 2012 05:55:52 PM
+ Size: 2.57 MB
+ FMRI: pkg://omnios/security/sudo@1.8.4.1,5.11-0.151002:20120401T175552Z
+PKG_STATUS
+ @provider.should_receive(:run_command_with_systems_locale).with({
+ :command => "pkg install -q security/sudo@1.8.4.1"
+ })
+ @provider.install_package("security/sudo", "1.8.4.1")
+ end
+
+ it "should not include the human-readable version in the candidate_version" do
+ @stdout.replace(<<-PKG_STATUS)
+ Name: security/sudo
+ Summary: sudo - authority delegation tool
+ State: Not Installed
+ Publisher: omnios
+ Version: 1.8.4.1 (1.8.4p1)
+ Build Release: 5.11
+ Branch: 0.151002
+Packaging Date: April 1, 2012 05:55:52 PM
+ Size: 2.57 MB
+ FMRI: pkg://omnios/security/sudo@1.8.4.1,5.11-0.151002:20120401T175552Z
+PKG_STATUS
+ @provider.should_receive(:shell_out!).and_return(@shell_out)
+ @provider.load_current_resource
+ @current_resource.version.should be_nil
+ @provider.candidate_version.should eql("1.8.4.1")
+ end
+
context "using the ips_package resource" do
before do
@new_resource = Chef::Resource::IpsPackage.new("crypto/gnupg", @run_context)