spec/unit/provider/service/launchd_spec.rb in puppet-3.1.0.rc1 vs spec/unit/provider/service/launchd_spec.rb in puppet-3.1.0.rc2
- old
+ new
@@ -58,27 +58,24 @@
describe "when checking whether the service is enabled on OS X 10.6" do
it "should return true if the job plist says disabled is true and the global overrides says disabled is false" do
provider.expects(:get_macosx_version_major).returns("10.6")
subject.expects(:plist_from_label).returns([joblabel, {"Disabled" => true}])
provider.expects(:read_plist).returns({joblabel => {"Disabled" => false}})
- provider.stubs(:launchd_overrides).returns(launchd_overrides)
FileTest.expects(:file?).with(launchd_overrides).returns(true)
subject.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.expects(:get_macosx_version_major).returns("10.6")
subject.expects(:plist_from_label).returns([joblabel, {"Disabled" => false}])
provider.expects(:read_plist).returns({joblabel => {"Disabled" => true}})
- provider.stubs(:launchd_overrides).returns(launchd_overrides)
FileTest.expects(:file?).with(launchd_overrides).returns(true)
subject.enabled?.should == :false
end
it "should return true if the job plist and the global overrides have no disabled keys" do
provider.expects(:get_macosx_version_major).returns("10.6")
subject.expects(:plist_from_label).returns([joblabel, {}])
provider.expects(:read_plist).returns({})
- provider.stubs(:launchd_overrides).returns(launchd_overrides)
FileTest.expects(:file?).with(launchd_overrides).returns(true)
subject.enabled?.should == :true
end
end
@@ -120,10 +117,16 @@
subject.expects(:enabled?).returns(:true)
subject.expects(:status).returns(:stopped)
subject.expects(:execute).with([:launchctl, :load, '-w', joblabel])
subject.start
end
+
+ it "(#16271) Should stop and start the service when a restart is called" do
+ subject.expects(:stop)
+ subject.expects(:start)
+ subject.restart
+ end
end
describe "when stopping the service" do
it "should call any explicit 'stop' command" do
resource[:stop] = "/bin/false"
@@ -189,21 +192,19 @@
describe "when enabling the service on OS X 10.6" do
it "should write to the global launchd overrides file once" do
resource[:enable] = true
provider.expects(:get_macosx_version_major).returns("10.6")
provider.expects(:read_plist).returns({})
- provider.stubs(:launchd_overrides).returns(launchd_overrides)
Plist::Emit.expects(:save_plist).once
subject.enable
end
end
describe "when disabling the service on OS X 10.6" do
it "should write to the global launchd overrides file once" do
resource[:enable] = false
provider.stubs(:get_macosx_version_major).returns("10.6")
provider.stubs(:read_plist).returns({})
- provider.stubs(:launchd_overrides).returns(launchd_overrides)
Plist::Emit.expects(:save_plist).once
subject.enable
end
end