mirror of
https://github.com/inspec/inspec
synced 2025-02-16 22:18:38 +00:00
bugfix: solve warn on uninitialized
@expectation was analyzed without initializeation, leading to ruby errors. fix it Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
This commit is contained in:
parent
2eef024c0c
commit
f731cbca92
1 changed files with 8 additions and 7 deletions
|
@ -66,13 +66,14 @@ module Inspec
|
|||
res, xtra = describe_chain
|
||||
itsy = xtra.nil? ? 'it' : 'its(' + xtra.to_s.inspect + ')'
|
||||
naughty = @negated ? '_not' : ''
|
||||
xpect = defined?(@expectation) ? expectation.inspect : ''
|
||||
if @expectation.class == Regexp
|
||||
# without this, xpect values like / \/zones\// will not be parsed properly
|
||||
xpect = "(#{xpect})"
|
||||
elsif xpect != ''
|
||||
xpect = ' ' + xpect
|
||||
end
|
||||
xpect = if !defined?(@expectation)
|
||||
''
|
||||
elsif @expectation.class == Regexp
|
||||
# without this, xpect values like / \/zones\// will not be parsed properly
|
||||
"(#{@expectation.inspect})"
|
||||
elsif xpect != ''
|
||||
' ' + expectation.inspect
|
||||
end
|
||||
format("%sdescribe %s do\n %s { should%s %s%s }\nend",
|
||||
vars, res, itsy, naughty, matcher, xpect)
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue