summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorMax Martin <max@puppetlabs.com>2011-07-06 15:04:27 -0700
committerMatt Robinson <matt@puppetlabs.com>2011-07-14 13:01:02 -0700
commitb268fb3d4cca79bdce0adc7da8b4d47f20769521 (patch)
tree8f23e45cc52d2040ade181487a601bca84f4c9aa /spec
parentb8e67ba44f7605260bc3141250d746ae748df2a2 (diff)
downloadpuppet-b268fb3d4cca79bdce0adc7da8b4d47f20769521.tar.gz
puppet-b268fb3d4cca79bdce0adc7da8b4d47f20769521.tar.xz
puppet-b268fb3d4cca79bdce0adc7da8b4d47f20769521.zip
(#7144) Update Settings#writesub to convert mode to Fixnum
Settings#writesub was not checking the type of the mode value passed in from the defaults, causing it to pass a string for mode to File.open, leading to failures. This commit resolves that issue. Paired-with: Matt Robinson <matt@puppetlabs.com>
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/util/settings_spec.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/spec/unit/util/settings_spec.rb b/spec/unit/util/settings_spec.rb
index 07b712c08..888de156b 100755
--- a/spec/unit/util/settings_spec.rb
+++ b/spec/unit/util/settings_spec.rb
@@ -1,6 +1,7 @@
#!/usr/bin/env ruby
require File.dirname(__FILE__) + '/../../spec_helper'
+require 'ostruct'
describe Puppet::Util::Settings do
describe "when specifying defaults" do
@@ -1105,4 +1106,14 @@ describe Puppet::Util::Settings do
it "should cache the result"
end
+
+ describe "#writesub" do
+ it "should only pass valid arguments to File.open" do
+ settings = Puppet::Util::Settings.new
+ settings.stubs(:get_config_file_default).with(:privatekeydir).returns(OpenStruct.new(:mode => "750"))
+
+ File.expects(:open).with("/path/to/keydir", "w", 750).returns true
+ settings.writesub(:privatekeydir, "/path/to/keydir")
+ end
+ end
end