diff --git a/lib/inspec/objects/test.rb b/lib/inspec/objects/test.rb index 583286c65..2de6bce50 100644 --- a/lib/inspec/objects/test.rb +++ b/lib/inspec/objects/test.rb @@ -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 != '' diff --git a/test/unit/dsl/objects_test.rb b/test/unit/dsl/objects_test.rb index b8bc5135f..3c818c741 100644 --- a/test/unit/dsl/objects_test.rb +++ b/test/unit/dsl/objects_test.rb @@ -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