mirror of
https://github.com/inspec/inspec
synced 2024-09-21 06:51:56 +00:00
Wrap regex in parenthesis no matter of the matcher used, ex: match, cmp
Signed-off-by: Alex Pop <apop@chef.io>
This commit is contained in:
parent
5a087bd256
commit
80ad877e02
2 changed files with 3 additions and 3 deletions
|
@ -67,7 +67,7 @@ module Inspec
|
|||
itsy = xtra.nil? ? 'it' : 'its(' + xtra.to_s.inspect + ')'
|
||||
naughty = @negated ? '_not' : ''
|
||||
xpect = defined?(@expectation) ? expectation.inspect : ''
|
||||
if matcher == 'match'
|
||||
if @expectation.class == Regexp
|
||||
# without this, xpect values like / \/zones\// will not be parsed properly
|
||||
xpect = "(#{xpect})"
|
||||
elsif xpect != ''
|
||||
|
|
|
@ -25,7 +25,7 @@ end
|
|||
obj.expectation = Regexp.new('^Desc.+$')
|
||||
obj.to_ruby.must_equal '
|
||||
describe resource.to_s do
|
||||
it { should cmp /^Desc.+$/ }
|
||||
it { should cmp(/^Desc.+$/) }
|
||||
end
|
||||
'.strip
|
||||
end
|
||||
|
@ -127,7 +127,7 @@ end
|
|||
loop_obj.to_ruby.must_equal '
|
||||
port(25).addresses.each do |entry|
|
||||
describe entry do
|
||||
it { should_not match("0.0.0.0") }
|
||||
it { should_not match "0.0.0.0" }
|
||||
end
|
||||
end
|
||||
'.strip
|
||||
|
|
Loading…
Reference in a new issue