diff --git a/spec/system/concat_spec.rb b/spec/system/concat_spec.rb index 943de7e..ee754f6 100644 --- a/spec/system/concat_spec.rb +++ b/spec/system/concat_spec.rb @@ -56,7 +56,7 @@ describe 'basic concat test' do end context 'owner/group root' do - pp=" + pp = <<-EOS concat { '/tmp/concat/file': owner => 'root', group => 'root', @@ -74,7 +74,7 @@ describe 'basic concat test' do content => '2', order => '02', } - " + EOS it_behaves_like 'successfully_applied', pp diff --git a/spec/system/deprecation_warnings_spec.rb b/spec/system/deprecation_warnings_spec.rb index 58e1e76..0cb5a01 100644 --- a/spec/system/deprecation_warnings_spec.rb +++ b/spec/system/deprecation_warnings_spec.rb @@ -13,75 +13,75 @@ describe 'deprecation warnings' do end context 'concat gnu parameter' do - pp=" + pp = <<-EOS concat { '/tmp/concat/file': gnu => 'foo', } concat::fragment { 'foo': target => '/tmp/concat/file', } - " + EOS w = 'The $gnu parameter to concat is deprecated and has no effect' it_behaves_like 'has_warning', pp, w end context 'concat::fragment mode parameter' do - pp=" + pp = <<-EOS concat { '/tmp/concat/file': } concat::fragment { 'foo': target => '/tmp/concat/file', mode => 'bar', } - " + EOS w = 'The $mode parameter to concat::fragment is deprecated and has no effect' it_behaves_like 'has_warning', pp, w end context 'concat::fragment owner parameter' do - pp=" + pp = <<-EOS concat { '/tmp/concat/file': } concat::fragment { 'foo': target => '/tmp/concat/file', owner => 'bar', } - " + EOS w = 'The $owner parameter to concat::fragment is deprecated and has no effect' it_behaves_like 'has_warning', pp, w end context 'concat::fragment group parameter' do - pp=" + pp = <<-EOS concat { '/tmp/concat/file': } concat::fragment { 'foo': target => '/tmp/concat/file', group => 'bar', } - " + EOS w = 'The $group parameter to concat::fragment is deprecated and has no effect' it_behaves_like 'has_warning', pp, w end context 'concat::fragment backup parameter' do - pp=" + pp = <<-EOS concat { '/tmp/concat/file': } concat::fragment { 'foo': target => '/tmp/concat/file', backup => 'bar', } - " + EOS w = 'The $backup parameter to concat::fragment is deprecated and has no effect' it_behaves_like 'has_warning', pp, w end context 'include concat::setup' do - pp=" + pp = <<-EOS include concat::setup - " + EOS w = 'concat::setup is deprecated as a public API of the concat module and should no longer be directly included in the manifest.' it_behaves_like 'has_warning', pp, w diff --git a/spec/system/empty_spec.rb b/spec/system/empty_spec.rb index 67d968e..383f478 100644 --- a/spec/system/empty_spec.rb +++ b/spec/system/empty_spec.rb @@ -2,14 +2,14 @@ require 'spec_helper_system' describe 'basic concat test' do context 'should run successfully' do - pp=" + pp = <<-EOS concat { '/tmp/concat/file': owner => root, group => root, mode => '0644', force => true, } - " + EOS context puppet_apply(pp) do its(:stderr) { should be_empty } diff --git a/spec/system/fragment_list_source_spec.rb b/spec/system/fragment_list_source_spec.rb index 5716ef7..ab15948 100644 --- a/spec/system/fragment_list_source_spec.rb +++ b/spec/system/fragment_list_source_spec.rb @@ -2,14 +2,15 @@ require 'spec_helper_system' describe 'concat::fragment source lists ' do context 'should create files containing first match only.' do - file1_contents="file1 contents" - file2_contents="file2 contents" + let(:file1_contents) { 'file1 contents' } + let(:file2_contents) { 'file2 contents' } before(:all) do + shell("/bin/echo '#{file1_contents}' > /tmp/concat/file1") shell("/bin/echo '#{file2_contents}' > /tmp/concat/file2") end - pp=" - + + pp = <<-EOS concat { '/tmp/concat/result_file1': owner => root, group => root, @@ -41,7 +42,8 @@ describe 'concat::fragment source lists ' do source => [ '/tmp/concat/file1', '/tmp/concat/file2' ], order => '01', } - " + EOS + context puppet_apply(pp) do its(:stderr) { should be_empty } its(:exit_code) { should_not == 1 } @@ -70,7 +72,8 @@ describe 'concat::fragment source lists ' do before(:all) do shell("/bin/rm /tmp/concat/fail_no_source /tmp/concat/nofilehere /tmp/concat/nothereeither") end - pp=" + + pp = <<-EOS concat { '/tmp/concat/fail_no_source': owner => root, group => root, @@ -82,7 +85,8 @@ describe 'concat::fragment source lists ' do source => [ '/tmp/concat/nofilehere', '/tmp/concat/nothereeither' ], order => '01', } - " + EOS + context puppet_apply(pp) do its(:exit_code) { should_not be_zero } its(:exit_code) { should_not == 1 } diff --git a/spec/system/replace_spec.rb b/spec/system/replace_spec.rb index 4844087..3cd18ba 100644 --- a/spec/system/replace_spec.rb +++ b/spec/system/replace_spec.rb @@ -2,9 +2,12 @@ require 'spec_helper_system' describe 'file should not replace' do - shell('echo "file exists" >> /tmp/concat/file') + before(:all) do + shell('echo "file exists" > /tmp/concat/file') + end + context 'should fail' do - pp=" + pp = <<-EOS concat { '/tmp/concat/file': owner => root, group => root, @@ -23,7 +26,7 @@ describe 'file should not replace' do content => '2', order => '02', } - " + EOS context puppet_apply(pp) do its(:stderr) { should be_empty } diff --git a/spec/system/symbolic_name_spec.rb b/spec/system/symbolic_name_spec.rb index 239aa80..caae647 100644 --- a/spec/system/symbolic_name_spec.rb +++ b/spec/system/symbolic_name_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper_system' describe 'symbolic name' do - pp=" + pp = <<-EOS concat { 'not_abs_path': path => '/tmp/concat/file', } @@ -17,7 +17,7 @@ describe 'symbolic name' do content => '2', order => '02', } - " + EOS context puppet_apply(pp) do its(:stderr) { should be_empty } diff --git a/spec/system/warn_spec.rb b/spec/system/warn_spec.rb index d5052ba..405dfd6 100644 --- a/spec/system/warn_spec.rb +++ b/spec/system/warn_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper_system' describe 'basic concat test' do context 'should run successfully' do - pp=" + pp = <<-EOS concat { '/tmp/concat/file': owner => root, group => root, @@ -21,7 +21,7 @@ describe 'basic concat test' do content => '2', order => '02', } - " + EOS context puppet_apply(pp) do its(:stderr) { should be_empty }