diff options
author | Dan Bode <dan@puppetlabs.com> | 2012-10-10 17:40:38 -0700 |
---|---|---|
committer | Dan Bode <dan@puppetlabs.com> | 2012-10-10 17:40:38 -0700 |
commit | 1106d70e881028ee2dfa476307444780c9c4cbaa (patch) | |
tree | d58ff7e2e0e2a96f8bed7c26c09c5962626d5dd0 /spec/unit | |
parent | cbc90d38347f8ca61de2208b16ffc76f9fd5938c (diff) | |
download | puppet-inifile-1106d70e881028ee2dfa476307444780c9c4cbaa.tar.gz puppet-inifile-1106d70e881028ee2dfa476307444780c9c4cbaa.tar.bz2 |
Add support for removing lines
This commit adds the ability to ensure that lines are absent.
Diffstat (limited to 'spec/unit')
-rw-r--r-- | spec/unit/puppet/provider/ini_setting/ruby_spec.rb | 46 |
1 files changed, 46 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 4062205..c8fcec4 100644 --- a/spec/unit/puppet/provider/ini_setting/ruby_spec.rb +++ b/spec/unit/puppet/provider/ini_setting/ruby_spec.rb @@ -458,7 +458,53 @@ bar=baz ) end + end + + context "when ensuring that a setting is absent" do + let(:orig_content) { + <<-EOS +[section1] +; This is also a comment +foo=foovalue + +bar = barvalue +master = true +[section2] + +foo= foovalue2 +baz=bazvalue +url = http://192.168.1.1:8080 +[section:sub] +subby=bar + #another comment + ; yet another comment +EOS + } + + it "should remove a setting that exists" do + resource = Puppet::Type::Ini_setting.new(common_params.merge( + :section => 'section1', :setting => 'foo', :ensure => 'absent')) + provider = described_class.new(resource) + provider.exists?.should be_true + provider.destroy + validate_file(<<-EOS +[section1] +; This is also a comment +bar = barvalue +master = true +[section2] + +foo= foovalue2 +baz=bazvalue +url = http://192.168.1.1:8080 +[section:sub] +subby=bar + #another comment + ; yet another comment +EOS + ) + end end end |