X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Fconcat%2Fspec%2Funit%2Fdefines%2Fconcat_fragment_spec.rb;fp=3rdparty%2Fmodules%2Fconcat%2Fspec%2Funit%2Fdefines%2Fconcat_fragment_spec.rb;h=0000000000000000000000000000000000000000;hb=30caaa85aed7015ca0d77216bff175eebd917eb7;hp=4815b93842764da883f1ffe1455b9844b0aac5df;hpb=6f656bd4265e3dab13b9af2bf96e9044322e9d8f;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/concat/spec/unit/defines/concat_fragment_spec.rb b/3rdparty/modules/concat/spec/unit/defines/concat_fragment_spec.rb deleted file mode 100644 index 4815b9384..000000000 --- a/3rdparty/modules/concat/spec/unit/defines/concat_fragment_spec.rb +++ /dev/null @@ -1,157 +0,0 @@ -require 'spec_helper' - -describe 'concat::fragment', :type => :define do - - shared_examples 'fragment' do |title, params| - params = {} if params.nil? - - p = { - :content => nil, - :source => nil, - :order => 10, - }.merge(params) - - let(:title) { title } - let(:params) { params } - let(:pre_condition) do - "concat{ '#{p[:target]}': }" - end - - it do - should contain_concat(p[:target]) - should contain_concat_file(p[:target]) - should contain_concat_fragment(title) - end - end - - context 'title' do - ['0', '1', 'a', 'z'].each do |title| - it_behaves_like 'fragment', title, { - :target => '/etc/motd', - :content => "content for #{title}" - } - end - end # title - - context 'target =>' do - ['./etc/motd', 'etc/motd', 'motd_header'].each do |target| - context target do - it_behaves_like 'fragment', target, { - :target => '/etc/motd', - :content => "content for #{target}" - } - end - end - - context 'false' do - let(:title) { 'motd_header' } - let(:params) {{ :target => false }} - - it 'should fail' do - expect { catalogue }.to raise_error(Puppet::Error, /parameter 'target' expects a .*String.*/) - end - end - end # target => - - context 'content =>' do - ['', 'ashp is our hero'].each do |content| - context content do - it_behaves_like 'fragment', 'motd_header', { - :content => content, - :target => '/etc/motd', - } - end - end - - context 'false' do - let(:title) { 'motd_header' } - let(:params) {{ :content => false, :target => '/etc/motd' }} - - it 'should fail' do - expect { catalogue }.to raise_error(Puppet::Error, /parameter 'content' expects a .*String.*/ ) - end - end - end # content => - - context 'source =>' do - ['', '/foo/bar', ['/foo/bar', '/foo/baz']].each do |source| - context source do - it_behaves_like 'fragment', 'motd_header', { - :source => source, - :target => '/etc/motd', - } - 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) {{ :order => false, :target => '/etc/motd' }} - - it 'should fail' do - expect { catalogue }.to raise_error(Puppet::Error, /Evaluation Error.*expects.*Boolean.*/) - 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/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', - :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/m) - end - end - end # more than one content source -end