diff options
author | Nigel Kersten <nigelk@google.com> | 2009-02-14 08:07:51 -0800 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-02-15 10:31:28 +1100 |
commit | 446989b6932e4a2324b9202fa05114046a6fb5df (patch) | |
tree | e522149df9e5237ffe9e77b2fc560f0b7561e39d | |
parent | 3ef58490204a309acd2d0a3dde4b6500a4f4a569 (diff) | |
download | puppet-446989b6932e4a2324b9202fa05114046a6fb5df.tar.gz puppet-446989b6932e4a2324b9202fa05114046a6fb5df.tar.xz puppet-446989b6932e4a2324b9202fa05114046a6fb5df.zip |
Fix spec test for launchd service provider to work with new service status method and add two new status tests.
Now ensures that given the correct input, the correct status for the launchd service is returned.
-rwxr-xr-x | spec/unit/provider/service/launchd.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/spec/unit/provider/service/launchd.rb b/spec/unit/provider/service/launchd.rb index cc2dae190..f2d69a47b 100755 --- a/spec/unit/provider/service/launchd.rb +++ b/spec/unit/provider/service/launchd.rb @@ -62,9 +62,17 @@ describe provider_class do describe "when checking status" do it "should call the external command 'launchctl list' once" do - @provider.expects(:launchctl).with(:list, @resource[:name]).returns(:running).once + @provider.expects(:launchctl).with(:list).returns("rotating-strawberry-madonnas") @provider.status end + it "should return stopped if not listed in launchctl list output" do + @provider.stubs(:launchctl).with(:list).returns("rotating-strawberry-madonnas") + assert_equal @provider.status, :stopped + end + it "should return running if listed in launchctl list output" do + @provider.stubs(:launchctl).with(:list).returns(@joblabel) + assert_equal @provider.status, :running + end end describe "when starting the service" do |