spec/unit/provider/service/runit.rb in puppet-0.25.0 vs spec/unit/provider/service/runit.rb in puppet-0.25.1

- old
+ new

@@ -33,10 +33,14 @@ @provider.stubs(:sv) @provider.stubs(:resource).returns @resource end + it "should have a restart method" do + @provider.should respond_to(:restart) + end + it "should have a restartcmd method" do @provider.should respond_to(:restartcmd) end it "should have a start method" do @@ -60,27 +64,34 @@ end describe "when starting" do it "should enable the service if it is not enabled" do @provider.stubs(:sv) - @provider.stubs(:ucommand) - @provider.expects(:enabled?).returns false + @provider.expects(:enabled?).returns :false @provider.expects(:enable) @provider.start end it "should execute external command 'sv start /etc/service/myservice'" do - @provider.expects(:ucommand).with(:start).returns("") + @provider.stubs(:enabled?).returns :true + @provider.expects(:sv).with("start", "/etc/service/myservice") @provider.start end end describe "when stopping" do it "should execute external command 'sv stop /etc/service/myservice'" do - @provider.expects(:ucommand).with(:stop).returns("") + @provider.expects(:sv).with("stop", "/etc/service/myservice") @provider.stop + end + end + + describe "when restarting" do + it "should call 'sv restart /etc/service/myservice'" do + @provider.expects(:sv).with("restart","/etc/service/myservice") + @provider.restart end end describe "when enabling" do it "should create a symlink between daemon dir and service dir" do