summaryrefslogtreecommitdiffstats
path: root/spec/unit/provider
diff options
context:
space:
mode:
authorJosh Cooper <josh@puppetlabs.com>2011-07-18 23:40:17 -0700
committerJosh Cooper <josh@puppetlabs.com>2011-07-19 14:08:38 -0700
commit0e4ae653c0628cb0df9ccace98bca4bc7478fb7c (patch)
treefa90342427d0cd41c6aea56df8d89d2deb3def9d /spec/unit/provider
parent8d56355981961fd1c4a358992930bbb80325fea7 (diff)
downloadpuppet-0e4ae653c0628cb0df9ccace98bca4bc7478fb7c.tar.gz
puppet-0e4ae653c0628cb0df9ccace98bca4bc7478fb7c.tar.xz
puppet-0e4ae653c0628cb0df9ccace98bca4bc7478fb7c.zip
Maint: Fix miscellaneous tests
Several tests were broken due to pecularities of Windows and Ruby on Windows: * Ruby on windows does not differentiate between group and other file permissions. * All open file handles must be closed before the file can be deleted * Sometimes the current working directory (Dir.getwd) is reported as C:/foo and other times as C:\\foo, which confuses the spec tests. * Ruby's sprintf formats floating point values differently on Windows vs Unix. The Windows exponent has an extra leading zero. * Needed to stub execution of security command with the SMF service provider. Reviewed-by: Jacob Helwig <jacob@puppetlabs.com>
Diffstat (limited to 'spec/unit/provider')
-rwxr-xr-xspec/unit/provider/macauthorization_spec.rb5
-rwxr-xr-xspec/unit/provider/service/smf_spec.rb1
2 files changed, 6 insertions, 0 deletions
diff --git a/spec/unit/provider/macauthorization_spec.rb b/spec/unit/provider/macauthorization_spec.rb
index a76f917f7..dbe36a04b 100755
--- a/spec/unit/provider/macauthorization_spec.rb
+++ b/spec/unit/provider/macauthorization_spec.rb
@@ -106,6 +106,11 @@ describe provider_class do
end
it "should call the internal method set_right" do
+ @provider.expects(:execute).with { |cmds, args|
+ cmds.include?("read") and
+ cmds.include?(@authname) and
+ args[:combine] == false
+ }.once
@provider.expects(:set_right)
@provider.flush
end
diff --git a/spec/unit/provider/service/smf_spec.rb b/spec/unit/provider/service/smf_spec.rb
index 5212d540a..fd7d50e3a 100755
--- a/spec/unit/provider/service/smf_spec.rb
+++ b/spec/unit/provider/service/smf_spec.rb
@@ -111,6 +111,7 @@ describe provider_class do
it "should import the manifest if service is missing" do
@provider.expects(:svccfg).with(:import, "/tmp/myservice.xml")
@provider.expects(:texecute).with(:start, ["/usr/sbin/svcadm", :enable, "/system/myservice"], true)
+ @provider.expects(:svcs).with('-H', '-o', 'state,nstate', "/system/myservice").returns("online\t-")
@provider.start
end