summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Cooper <josh@puppetlabs.com>2011-08-18 14:23:15 -0700
committerJosh Cooper <josh@puppetlabs.com>2011-08-22 09:40:20 -0700
commit9f39cc476246e307ec4d8861502c1d5b8ce1bc21 (patch)
tree498de431f2ada8b549b4c7e563fbe6a0ec8d152b
parent299932691c7a67c93275e978c52132ff99cae4f5 (diff)
downloadpuppet-9f39cc476246e307ec4d8861502c1d5b8ce1bc21.tar.gz
puppet-9f39cc476246e307ec4d8861502c1d5b8ce1bc21.tar.xz
puppet-9f39cc476246e307ec4d8861502c1d5b8ce1bc21.zip
maint: Stub spec test so directory is not created unnecessarily
One of the spec tests required that the parent directory (in this case /tmp) already exist and that /tmp/my_directory could be created. This fails on Windows as /tmp likely doesn't exist, and also the test doesn't actually need to create the directory. This commit forces the call to exists? with the parent directory to return true, and stubs the mkdir call so that the directory is not actually created. It also makes the raise_error expectation look for the specific error message, instead of a generic DevError.
-rwxr-xr-xspec/unit/indirector/ssl_file_spec.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/spec/unit/indirector/ssl_file_spec.rb b/spec/unit/indirector/ssl_file_spec.rb
index e0e30bd9d..8ee19c8c8 100755
--- a/spec/unit/indirector/ssl_file_spec.rb
+++ b/spec/unit/indirector/ssl_file_spec.rb
@@ -19,7 +19,7 @@ describe Puppet::Indirector::SslFile do
@setting = :certdir
@file_class.store_in @setting
- @path = make_absolute("/tmp/my_directory")
+ @path = make_absolute("/thisdoesntexist/my_directory")
Puppet[:noop] = false
Puppet[@setting] = @path
Puppet[:trace] = false
@@ -43,7 +43,9 @@ describe Puppet::Indirector::SslFile do
it "should fail if no store directory or file location has been set" do
@file_class.store_in nil
@file_class.store_at nil
- lambda { @file_class.new }.should raise_error(Puppet::DevError)
+ FileTest.expects(:exists?).with(File.dirname(@path)).at_least(0).returns(true)
+ Dir.stubs(:mkdir).with(@path)
+ lambda { @file_class.new }.should raise_error(Puppet::DevError, /No file or directory setting provided/)
end
describe "when managing ssl files" do