diff --git a/spec/acceptance/report_spec.rb b/spec/acceptance/report_spec.rb index ec1a865b9..3fb1c0592 100644 --- a/spec/acceptance/report_spec.rb +++ b/spec/acceptance/report_spec.rb @@ -9,7 +9,7 @@ before(:all) do File.open(init_pp, 'w') do |f| f.puts <<~EOS - class report {} + class report EOS end end @@ -25,8 +25,8 @@ class report {} describe file('report.txt') do it { is_expected.to exist } - # pdk (WARNING): puppet-lint: class not documented (manifests/init.pp:1:1) - its(:content) { is_expected.to match(/\(warning\):.*class not documented.*\(#{Regexp.escape(init_pp)}.*\)/i) } + # pdk (ERROR): puppet-syntax: Could not parse for environment production: Syntax error at end of input (manifests/init.pp) + its(:content) { is_expected.to match(/\(ERROR\):.*Could not parse for environment production.*\(#{Regexp.escape(init_pp)}.*\)/i) } end end @@ -35,7 +35,7 @@ class report {} its(:exit_status) { is_expected.to eq(0) } its(:stderr) { is_expected.to match(/Checking Puppet manifest syntax/i) } its(:stderr) { is_expected.to match(/Checking Puppet manifest style/i) } - its(:stdout) { is_expected.to match(/\(warning\):.*class not documented.*\(#{Regexp.escape(init_pp)}.*\)/i) } + its(:stdout) { is_expected.to match(//\(ERROR\):.*Could not parse for environment production.*\(#{Regexp.escape(init_pp)}.*\)/i) } describe file('stdout') do it { is_expected.not_to exist } @@ -52,7 +52,7 @@ class report {} its(:stderr) do # Due to spinners writing at arbitrary cursor locations, we can't depend on the text # being at a the beginning of a line. - is_expected.to match(/\(warning\):.*class not documented.*\(#{Regexp.escape(init_pp)}.*\)/i) + is_expected.to match(//\(ERROR\):.*Could not parse for environment production.*\(#{Regexp.escape(init_pp)}.*\)/i) end describe file('stderr') do @@ -66,7 +66,7 @@ class report {} its(:exit_status) { is_expected.to eq(0) } its(:stderr) { is_expected.to match(/using ruby \d+\.\d+\.\d+/i) } its(:stderr) { is_expected.to match(/using puppet \d+\.\d+\.\d+/i) } - its(:stdout) { is_expected.to match(/\(warning\):.*class not documented.*\(#{Regexp.escape(init_pp)}.*\)/i) } + its(:stdout) { is_expected.to match(//\(ERROR\):.*Could not parse for environment production.*\(#{Regexp.escape(init_pp)}.*\)/i) } end end end diff --git a/spec/acceptance/validate_all_spec.rb b/spec/acceptance/validate_all_spec.rb index 247ec5ff9..e5789a979 100644 --- a/spec/acceptance/validate_all_spec.rb +++ b/spec/acceptance/validate_all_spec.rb @@ -99,7 +99,7 @@ class validate_all { end File.open(File.join('manifests', 'init.pp'), 'w') do |f| - f.puts <<-EOS.gsub(/^ {10}/, '') + f.puts <<-EOS # pdk_in_gemfile class pdk_in_gemfile {} EOS diff --git a/spec/acceptance/validate_puppet_spec.rb b/spec/acceptance/validate_puppet_spec.rb index 27452cc73..bf218a67d 100644 --- a/spec/acceptance/validate_puppet_spec.rb +++ b/spec/acceptance/validate_puppet_spec.rb @@ -81,7 +81,7 @@ class foo { end describe command('pdk validate puppet --format text:stdout --format junit:report.xml') do - its(:exit_status) { is_expected.to eq(0) } + its(:exit_status) { is_expected.to eq(1) } its(:stderr) { is_expected.not_to match(epp_spinner_text) } its(:stderr) { is_expected.to match(syntax_spinner_text) } its(:stderr) { is_expected.to match(lint_spinner_text) } @@ -180,7 +180,10 @@ class foo { context 'with a parsable file and some style warnings' do before(:all) do File.open(init_pp, 'w') do |f| - f.puts 'class foo {}' + f.puts <<-EOS.gsub(/^ {10}/, '') + # pdk_in_gemfile + class pdk_in_gemfile {} + EOS end end @@ -190,7 +193,7 @@ class foo { describe command('pdk validate puppet --format text:stdout --format junit:report.xml') do its(:exit_status) { is_expected.to eq(0) } - its(:stdout) { is_expected.to match(/\(warning\):.*class not documented.*\(#{Regexp.escape(init_pp)}.+\)/i) } + its(:stdout) { is_expected.to match(/\(warning\):.*indent should be 0 chars and is 2.*\(#{Regexp.escape(init_pp)}.+\)/i) } its(:stderr) { is_expected.not_to match(epp_spinner_text) } its(:stderr) { is_expected.to match(syntax_spinner_text) } its(:stderr) { is_expected.to match(lint_spinner_text) }