summaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
authorHunter Haugen <hunter@puppetlabs.com>2016-04-07 15:10:07 -0700
committerHunter Haugen <hunter@puppetlabs.com>2016-04-07 15:10:07 -0700
commitbe1ff3f09e35d5e6aa1d2112311ba9e5258b76f1 (patch)
tree5e9fb3318d444091b48638c3bc8139bfd9e90e37 /spec/unit
parent6248d241bc839b0717b6e881858d1e38938f3aa3 (diff)
parent7e408ca7970fd172822db02227935798f9ff282f (diff)
Merge pull request #585 from jearls/MODULES-2370-update-validate-to-not-require-line-when-matching-for-absence
[MODULES-2370] file_line.rb: Fix `line` attribute validation
Diffstat (limited to 'spec/unit')
-rwxr-xr-xspec/unit/puppet/type/file_line_spec.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/spec/unit/puppet/type/file_line_spec.rb b/spec/unit/puppet/type/file_line_spec.rb
index f1430f2..48e2670 100755
--- a/spec/unit/puppet/type/file_line_spec.rb
+++ b/spec/unit/puppet/type/file_line_spec.rb
@@ -41,10 +41,13 @@ 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