diff options
author | asif.shaikh <ripclaw_ffb@hotmail.com> | 2017-02-01 20:14:27 -0800 |
---|---|---|
committer | Eric Putnam <putnam.eric@gmail.com> | 2017-07-18 14:24:43 -0700 |
commit | 703fa777e1daee97e2aea529064d773662ef1fe0 (patch) | |
tree | 74b26c4edd0858327d670ae39689e5b22c806ce4 /spec | |
parent | 596878a7bc1fd4a64da89c5c760accb3e8178ec1 (diff) |
Add new file_line option append_on_no_match
Diffstat (limited to 'spec')
-rwxr-xr-x | spec/unit/puppet/provider/file_line/ruby_spec.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/unit/puppet/provider/file_line/ruby_spec.rb b/spec/unit/puppet/provider/file_line/ruby_spec.rb index ab6edf9..dcca4a4 100755 --- a/spec/unit/puppet/provider/file_line/ruby_spec.rb +++ b/spec/unit/puppet/provider/file_line/ruby_spec.rb @@ -194,6 +194,24 @@ describe provider_class, :unless => Puppet::Util::Platform.windows? do @provider.create expect(File.read(@tmpfile).chomp).to eql("foo1\nfoo = bar\nfoo2") end + + it 'should not add line after no matches found' do + @resource = Puppet::Type::File_line.new( + { + :name => 'foo', + :path => @tmpfile, + :line => 'inserted = line', + :match => '^foo3$', + :append_on_no_match => false, + } + ) + @provider = provider_class.new(@resource) + File.open(@tmpfile, 'w') do |fh| + fh.write("foo1\nfoo = blah\nfoo2\nfoo = baz") + end + expect(@provider.exists?).to be true + expect(File.read(@tmpfile).chomp).to eql("foo1\nfoo = blah\nfoo2\nfoo = baz") + end end describe 'using after' do |