diff options
author | Chris Price <chris@puppetlabs.com> | 2013-03-12 11:11:09 -0700 |
---|---|---|
committer | Chris Price <chris@puppetlabs.com> | 2013-03-12 11:11:09 -0700 |
commit | 8064df6d004b7e24104c7899053a5c8627c35e1b (patch) | |
tree | 208e12d5e553a504ac561d224c9577fd3d64e423 /spec | |
parent | 5fdca54f6e96c861502d6fcff85a563be9d36fa0 (diff) | |
parent | 5f71d7f0bd78bbcc587210c9d251b92e1a1dea0f (diff) | |
download | puppet-inifile-8064df6d004b7e24104c7899053a5c8627c35e1b.tar.gz puppet-inifile-8064df6d004b7e24104c7899053a5c8627c35e1b.tar.bz2 |
Merge pull request #30 from bodepd/fix_nil_indentation
guard against nil indentation values
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/puppet/provider/ini_setting/ruby_spec.rb | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/spec/unit/puppet/provider/ini_setting/ruby_spec.rb b/spec/unit/puppet/provider/ini_setting/ruby_spec.rb index 7204f88..b73a3fa 100644 --- a/spec/unit/puppet/provider/ini_setting/ruby_spec.rb +++ b/spec/unit/puppet/provider/ini_setting/ruby_spec.rb @@ -887,6 +887,46 @@ blah = blah ) end + context 'when a section only contains comments' do + let(:orig_content) { + <<-EOS +[section1] +# foo=foovalue +# bar=bar2 +EOS + } + it 'should be able to add a new setting when a section contains only comments' do + resource = Puppet::Type::Ini_setting.new( + common_params.merge(:section => 'section1', :setting => 'foo', :value => 'foovalue2') + ) + provider = described_class.new(resource) + provider.exists?.should be_false + provider.create + validate_file(<<-EOS +[section1] +# foo=foovalue +foo=foovalue2 +# bar=bar2 + EOS + ) + end + it 'should be able to add a new setting when it matches a commented out line other than the first one' do + resource = Puppet::Type::Ini_setting.new( + common_params.merge(:section => 'section1', :setting => 'bar', :value => 'barvalue2') + ) + provider = described_class.new(resource) + provider.exists?.should be_false + provider.create + validate_file(<<-EOS +[section1] +# foo=foovalue +# bar=bar2 +bar=barvalue2 + EOS + ) + end + end + end end |