summaryrefslogtreecommitdiff
path: root/spec/unit/puppet/provider
diff options
context:
space:
mode:
authorChris Price <chris@puppetlabs.com>2012-10-17 13:27:28 -0700
committerChris Price <chris@puppetlabs.com>2012-10-17 13:27:28 -0700
commitcda30a6ab9b6fa673ead091ab0b130cbc6e75dbc (patch)
tree17a5bb35c8861a745786105eeaee2e7d8479e711 /spec/unit/puppet/provider
parent1106d70e881028ee2dfa476307444780c9c4cbaa (diff)
downloadpuppet-inifile-cda30a6ab9b6fa673ead091ab0b130cbc6e75dbc.tar.gz
puppet-inifile-cda30a6ab9b6fa673ead091ab0b130cbc6e75dbc.tar.bz2
Minor tweaks to handling of removing settings
This commit makes some minor changes to how we handle removing settings. In particular, it updates all of the line numbers of the various 'section' objects to correspond to the new state of the world based on the removal of a line that appeared before them. Also adds one more test related to setting removal.
Diffstat (limited to 'spec/unit/puppet/provider')
-rw-r--r--spec/unit/puppet/provider/ini_setting/ruby_spec.rb26
1 files changed, 26 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 c8fcec4..8b2f8e5 100644
--- a/spec/unit/puppet/provider/ini_setting/ruby_spec.rb
+++ b/spec/unit/puppet/provider/ini_setting/ruby_spec.rb
@@ -505,6 +505,32 @@ subby=bar
EOS
)
end
+
+ it "should do nothing for a setting that does not exist" do
+ resource = Puppet::Type::Ini_setting.new(common_params.merge(
+ :section => 'section:sub', :setting => 'foo', :ensure => 'absent'))
+ provider = described_class.new(resource)
+ provider.exists?.should be_nil
+ provider.destroy
+ validate_file(<<-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
+ )
+ end
end
end