summaryrefslogtreecommitdiffstats
path: root/spec/unit/provider/service
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-01-08 17:35:51 -0800
committerJesse Wolfe <jes5199@gmail.com>2010-01-08 22:10:39 -0800
commit0a7e212cb824a3a13bc00abf2e69aa3852c6c4d9 (patch)
tree5f853107d4560da13ec1782f7d6e4bc64206a766 /spec/unit/provider/service
parentdd22b71161b0ab943bc3f6edbf6f104e1c882a14 (diff)
downloadpuppet-0a7e212cb824a3a13bc00abf2e69aa3852c6c4d9.tar.gz
puppet-0a7e212cb824a3a13bc00abf2e69aa3852c6c4d9.tar.xz
puppet-0a7e212cb824a3a13bc00abf2e69aa3852c6c4d9.zip
Fix #2887 'service' tests paths too early
The 'service' type was testing to see if init script directories exist too early, causing failures if you expected to be able to create those directories via puppet. This patch moves that logic into the 'init' provider. Signed-off-by: Jesse Wolfe <jes5199@gmail.com>
Diffstat (limited to 'spec/unit/provider/service')
-rwxr-xr-xspec/unit/provider/service/init.rb17
1 files changed, 16 insertions, 1 deletions
diff --git a/spec/unit/provider/service/init.rb b/spec/unit/provider/service/init.rb
index 0bfeb9a18..32bfaa204 100755
--- a/spec/unit/provider/service/init.rb
+++ b/spec/unit/provider/service/init.rb
@@ -16,12 +16,26 @@ describe provider_class do
# @resource.stubs(:[]).with(:ensure).returns :enabled
@resource.stubs(:[]).with(:path).returns ["/service/path","/alt/service/path"]
# @resource.stubs(:ref).returns "Service[myservice]"
+ File.stubs(:directory?).returns(true)
@provider = provider_class.new
@provider.resource = @resource
end
- describe "when serching for the init script" do
+
+ describe "when searching for the init script" do
+ it "should discard paths that do not exist" do
+ File.stubs(:exist?).returns(false)
+ File.stubs(:directory?).returns(false)
+ @provider.paths.should be_empty
+ end
+
+ it "should discard paths that are not directories" do
+ File.stubs(:exist?).returns(true)
+ File.stubs(:directory?).returns(false)
+ @provider.paths.should be_empty
+ end
+
it "should be able to find the init script in the service path" do
File.expects(:stat).with("/service/path/myservice").returns true
@provider.initscript.should == "/service/path/myservice"
@@ -102,5 +116,6 @@ describe provider_class do
@provider.restart
end
end
+
end
end