diff options
Diffstat (limited to 'spec/unit')
| -rwxr-xr-x | spec/unit/util/settings.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/unit/util/settings.rb b/spec/unit/util/settings.rb index aa2101f6e..56428132d 100755 --- a/spec/unit/util/settings.rb +++ b/spec/unit/util/settings.rb @@ -579,6 +579,25 @@ describe Puppet::Util::Settings do # and we should now have the new value in memory @settings[:two].should == "disk-replace" end + + it "should retain in-memory values if the file has a syntax error" do + # Init the value + text = "[main]\none = initial-value\n" + @settings.expects(:read_file).returns(text) + @settings.parse + @settings[:one].should == "initial-value" + + # Now replace the value with something bogus + text = "[main]\nkenny = killed-by-what-follows\n1 is 2, blah blah florp\n" + @settings.expects(:read_file).returns(text) + @settings.parse + + # The originally-overridden value should not be replaced with the default + @settings[:one].should == "initial-value" + + # and we should not have the new value in memory + @settings[:kenny].should be_nil + end end it "should provide a method for creating a catalog of resources from its configuration" do |
