summaryrefslogtreecommitdiff
path: root/spec/unit/puppet/type/file_line_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/puppet/type/file_line_spec.rb')
-rwxr-xr-xspec/unit/puppet/type/file_line_spec.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/spec/unit/puppet/type/file_line_spec.rb b/spec/unit/puppet/type/file_line_spec.rb
index 410d0bf..48e2670 100755
--- a/spec/unit/puppet/type/file_line_spec.rb
+++ b/spec/unit/puppet/type/file_line_spec.rb
@@ -41,14 +41,20 @@ describe Puppet::Type.type(:file_line) do
expect { file_line[:path] = 'file' }.to raise_error(Puppet::Error, /File paths must be fully qualified/)
end
it 'should require that a line is specified' do
- expect { Puppet::Type.type(:file_line).new(:name => 'foo', :path => '/tmp/file') }.to raise_error(Puppet::Error, /Both line and path are required attributes/)
+ expect { Puppet::Type.type(:file_line).new(:name => 'foo', :path => '/tmp/file') }.to raise_error(Puppet::Error, /line is a required attribute/)
+ end
+ it 'should not require that a line is specified when matching for absence' do
+ expect { Puppet::Type.type(:file_line).new(:name => 'foo', :path => '/tmp/file', :ensure => :absent, :match_for_absence => :true, :match => 'match') }.not_to raise_error
end
it 'should require that a file is specified' do
- expect { Puppet::Type.type(:file_line).new(:name => 'foo', :line => 'path') }.to raise_error(Puppet::Error, /Both line and path are required attributes/)
+ expect { Puppet::Type.type(:file_line).new(:name => 'foo', :line => 'path') }.to raise_error(Puppet::Error, /path is a required attribute/)
end
it 'should default to ensure => present' do
expect(file_line[:ensure]).to eq :present
end
+ it 'should default to replace => true' do
+ expect(file_line[:replace]).to eq :true
+ end
it "should autorequire the file it manages" do
catalog = Puppet::Resource::Catalog.new