9
9
before ( :all ) do
10
10
File . open ( init_pp , 'w' ) do |f |
11
11
f . puts <<~EOS
12
- class report {}
12
+ class report
13
13
EOS
14
14
end
15
15
end
@@ -18,24 +18,24 @@ class report {}
18
18
include_context 'with a fake TTY'
19
19
# Tests writing reports to a file
20
20
describe command ( 'pdk validate puppet manifests/init.pp --format=text:report.txt' ) do
21
- its ( :exit_status ) { is_expected . to eq ( 0 ) }
21
+ its ( :exit_status ) { is_expected . to eq ( 1 ) }
22
22
its ( :stdout ) { is_expected . to have_no_output }
23
23
its ( :stderr ) { is_expected . to match ( /Checking Puppet manifest syntax/i ) }
24
24
its ( :stderr ) { is_expected . to match ( /Checking Puppet manifest style/i ) }
25
25
26
26
describe file ( 'report.txt' ) do
27
27
it { is_expected . to exist }
28
- # pdk (WARNING ): puppet-lint: class not documented (manifests/init.pp:1:1 )
29
- its ( :content ) { is_expected . to match ( /\( warning \) :.*class not documented .*\( #{ Regexp . escape ( init_pp ) } .*\) /i ) }
28
+ # pdk (ERROR ): puppet-syntax: Could not parse for environment production: Syntax error at end of input (manifests/init.pp)
29
+ its ( :content ) { is_expected . to match ( /\( ERROR \) :.*Could not parse for environment production .*\( #{ Regexp . escape ( init_pp ) } .*\) /i ) }
30
30
end
31
31
end
32
32
33
33
# Tests writing reports to stdout doesn't actually write a file named stdout
34
34
describe command ( 'pdk validate puppet manifests/init.pp --format=text:stdout' ) do
35
- its ( :exit_status ) { is_expected . to eq ( 0 ) }
35
+ its ( :exit_status ) { is_expected . to eq ( 1 ) }
36
36
its ( :stderr ) { is_expected . to match ( /Checking Puppet manifest syntax/i ) }
37
37
its ( :stderr ) { is_expected . to match ( /Checking Puppet manifest style/i ) }
38
- its ( :stdout ) { is_expected . to match ( /\( warning \) :.*class not documented .*\( #{ Regexp . escape ( init_pp ) } .*\) /i ) }
38
+ its ( :stdout ) { is_expected . to match ( /\( ERROR \) :.*Could not parse for environment production .*\( #{ Regexp . escape ( init_pp ) } .*\) /i ) }
39
39
40
40
describe file ( 'stdout' ) do
41
41
it { is_expected . not_to exist }
@@ -44,15 +44,15 @@ class report {}
44
44
45
45
# Tests writing reports to stderr doesn't actually write a file named stderr
46
46
describe command ( 'pdk validate puppet manifests/init.pp --format=text:stderr' ) do
47
- its ( :exit_status ) { is_expected . to eq ( 0 ) }
47
+ its ( :exit_status ) { is_expected . to eq ( 1 ) }
48
48
its ( :stdout ) { is_expected . to have_no_output }
49
49
its ( :stderr ) { is_expected . to match ( /Checking Puppet manifest syntax/i ) }
50
50
its ( :stderr ) { is_expected . to match ( /Checking Puppet manifest style/i ) }
51
51
52
52
its ( :stderr ) do
53
53
# Due to spinners writing at arbitrary cursor locations, we can't depend on the text
54
54
# being at a the beginning of a line.
55
- is_expected . to match ( /\( warning \) :.*class not documented .*\( #{ Regexp . escape ( init_pp ) } .*\) /i )
55
+ is_expected . to match ( /\( ERROR \) :.*Could not parse for environment production .*\( #{ Regexp . escape ( init_pp ) } .*\) /i )
56
56
end
57
57
58
58
describe file ( 'stderr' ) do
@@ -63,10 +63,10 @@ class report {}
63
63
64
64
context 'when not run interactively' do
65
65
describe command ( 'pdk validate puppet manifests/init.pp' ) do
66
- its ( :exit_status ) { is_expected . to eq ( 0 ) }
66
+ its ( :exit_status ) { is_expected . to eq ( 1 ) }
67
67
its ( :stderr ) { is_expected . to match ( /using ruby \d +\. \d +\. \d +/i ) }
68
68
its ( :stderr ) { is_expected . to match ( /using puppet \d +\. \d +\. \d +/i ) }
69
- its ( :stdout ) { is_expected . to match ( /\( warning \) :.*class not documented .*\( #{ Regexp . escape ( init_pp ) } .*\) /i ) }
69
+ its ( :stdout ) { is_expected . to match ( /\( ERROR \) :.*Could not parse for environment production .*\( #{ Regexp . escape ( init_pp ) } .*\) /i ) }
70
70
end
71
71
end
72
72
end
0 commit comments