:order => 10,
}.merge(params)
- id = 'root'
- gid = 'root'
-
let(:title) { title }
let(:params) { params }
let(:pre_condition) do
let(:params) {{ :target => false }}
it 'should fail' do
- expect { catalogue }.to raise_error(Puppet::Error, /is not a string/)
+ expect { catalogue }.to raise_error(Puppet::Error, /parameter 'target' expects a .*String.*/)
end
end
end # target =>
let(:params) {{ :content => false, :target => '/etc/motd' }}
it 'should fail' do
- expect { catalogue }.to raise_error(Puppet::Error, /is not a string/)
+ expect { catalogue }.to raise_error(Puppet::Error, /parameter 'content' expects a .*String.*/ )
end
end
end # content =>
end
end
+ context 'false' do
+ let(:title) { 'motd_header' }
+ let(:params) {{ :source => false, :target => '/etc/motd' }}
+
+ it 'should fail' do
+ expect { catalogue }.to raise_error(Puppet::Error, /parameter 'source' expects a .*String.*Array.*/)
+ end
+ end
+ end # source =>
+
+ context 'order =>' do
+ ['', '42', 'a', 'z'].each do |order|
+ context '\'\'' do
+ it_behaves_like 'fragment', 'motd_header', {
+ :order => order,
+ :target => '/etc/motd',
+ }
+ end
+ end
+
context 'false' do
let(:title) { 'motd_header' }
- let(:params) {{ :source => false, :target => '/etc/motd' }}
+ let(:params) {{ :order => false, :target => '/etc/motd' }}
it 'should fail' do
- expect { catalogue }.to raise_error(Puppet::Error, /is not a string or an Array/)
+ expect { catalogue }.to raise_error(Puppet::Error, /Evaluation Error.*expects.*Boolean.*/)
end
end
- end # source =>
+
+ context '123:456' do
+ let(:title) { 'motd_header' }
+ let(:params) {{ :order => '123:456', :target => '/etc/motd' }}
+
+ it 'should fail' do
+ expect { catalogue }.to raise_error(Puppet::Error, /cannot contain/)
+ end
+ end
+ context '123/456' do
+ let(:title) { 'motd_header' }
+ let(:params) {{ :order => '123/456', :target => '/etc/motd' }}
+
+ it 'should fail' do
+ expect { catalogue }.to raise_error(Puppet::Error, /cannot contain/)
+ end
+ end
+ context '123\n456' do
+ let(:title) { 'motd_header' }
+ let(:params) {{ :order => "123\n456", :target => '/etc/motd' }}
+
+ it 'should fail' do
+ expect { catalogue }.to raise_error(Puppet::Error, /cannot contain/)
+ end
+ end
+ end # order =>
context 'more than one content source' do
context 'source and content' do
let(:title) { 'motd_header' }
let(:params) do
{
- :target => '/etc/motd',
+ :target => '/etc/motd',
:source => '/foo',
:content => 'bar',
}
end
it 'should fail' do
- expect { catalogue }.to raise_error(Puppet::Error, /Can't use 'source' and 'content' at the same time/)
+ expect { catalogue }.to raise_error(Puppet::Error, /Can\'t use \'source\' and \'content\' at the same time/m)
end
end
end # more than one content source