From bcab71ded8507de4fd9f89b4dcf798b3d98ace59 Mon Sep 17 00:00:00 2001 From: Hailee Kenney Date: Thu, 6 Oct 2016 15:23:35 -0700 Subject: (MODULES-3590) Fix match_for_absence parameter Prior to this commit, due to a bug in the exists? method in the file_line provider, match_for_absence didn't work as described (or at all really). Update the exists? logic so that match_for_absence works as described. Additionally add a unit test to prevent regressions and update the documentation for the parameter to reflect the fact that it is ignored when `ensure => present`. --- spec/unit/puppet/provider/file_line/ruby_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'spec/unit/puppet/provider/file_line') diff --git a/spec/unit/puppet/provider/file_line/ruby_spec.rb b/spec/unit/puppet/provider/file_line/ruby_spec.rb index fdeaf1a..1f41f62 100755 --- a/spec/unit/puppet/provider/file_line/ruby_spec.rb +++ b/spec/unit/puppet/provider/file_line/ruby_spec.rb @@ -363,6 +363,13 @@ describe provider_class do @provider = provider_class.new(@resource) end + it 'should find a line to match' do + File.open(@tmpfile, 'w') do |fh| + fh.write("foo1\nfoo\nfoo2") + end + expect(@provider.exists?).to be_truthy + end + it 'should remove one line if it matches' do File.open(@tmpfile, 'w') do |fh| fh.write("foo1\nfoo\nfoo2") -- cgit v1.2.3