summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorPaul Berry <paul@puppetlabs.com>2010-09-24 14:10:27 -0700
committerMarkus Roberts <Markus@reality.com>2010-09-29 10:44:23 -0700
commita7fb9b112025e328304743c6453ece5d6ae81275 (patch)
tree44be138bb4c834b1fa2ead898f6008285449c1cf /spec
parent25738726526c6618906eb02878f32bb276fec26f (diff)
downloadpuppet-a7fb9b112025e328304743c6453ece5d6ae81275.tar.gz
puppet-a7fb9b112025e328304743c6453ece5d6ae81275.tar.xz
puppet-a7fb9b112025e328304743c6453ece5d6ae81275.zip
Fixed #4025 (failure in launchd if certain plists are binary).
Modified the launchd provider to use OSX's "plutil" command to read plists. This allows it to handle properly lists in both XML format and binary format. Launchd continues to write out propertly lists in XML format. This is not a problem because the operating system is able to understand both formats.
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/provider/service/launchd_spec.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/spec/unit/provider/service/launchd_spec.rb b/spec/unit/provider/service/launchd_spec.rb
index 320ee3ace..05d76972d 100755
--- a/spec/unit/provider/service/launchd_spec.rb
+++ b/spec/unit/provider/service/launchd_spec.rb
@@ -95,22 +95,23 @@ describe provider_class do
end
describe "when checking whether the service is enabled on OS X 10.6" do
+ confine "Not running on OSX" => (Facter.value(:operatingsystem) == "Darwin")
it "should return true if the job plist says disabled is true and the global overrides says disabled is false" do
provider_class.stubs(:get_macosx_version_major).returns("10.6")
@provider.stubs(:plist_from_label).returns(["foo", {"Disabled" => true}])
- Plist.stubs(:parse_xml).returns({@resource[:name] => {"Disabled" => false}})
+ @provider.class.stubs(:read_plist).returns({@resource[:name] => {"Disabled" => false}})
@provider.enabled?.should == :true
end
it "should return false if the job plist says disabled is false and the global overrides says disabled is true" do
provider_class.stubs(:get_macosx_version_major).returns("10.6")
@provider.stubs(:plist_from_label).returns(["foo", {"Disabled" => false}])
- Plist.stubs(:parse_xml).returns({@resource[:name] => {"Disabled" => true}})
+ @provider.class.stubs(:read_plist).returns({@resource[:name] => {"Disabled" => true}})
@provider.enabled?.should == :false
end
it "should return true if the job plist and the global overrides have no disabled keys" do
provider_class.stubs(:get_macosx_version_major).returns("10.6")
@provider.stubs(:plist_from_label).returns(["foo", {}])
- Plist.stubs(:parse_xml).returns({})
+ @provider.class.stubs(:read_plist).returns({})
@provider.enabled?.should == :true
end
end
@@ -182,7 +183,7 @@ describe provider_class do
describe "when enabling the service on OS X 10.6" do
it "should write to the global launchd overrides file once" do
provider_class.stubs(:get_macosx_version_major).returns("10.6")
- Plist.stubs(:parse_xml).returns({})
+ @provider.class.stubs(:read_plist).returns({})
Plist::Emit.expects(:save_plist).once
@provider.enable
end
@@ -191,7 +192,7 @@ describe provider_class do
describe "when disabling the service on OS X 10.6" do
it "should write to the global launchd overrides file once" do
provider_class.stubs(:get_macosx_version_major).returns("10.6")
- Plist.stubs(:parse_xml).returns({})
+ @provider.class.stubs(:read_plist).returns({})
Plist::Emit.expects(:save_plist).once
@provider.enable
end