Sha256: f41a199ae437b366e6cbd705c2b847cb4b7682a69a68442402f546de27e1ed88
Contents?: true
Size: 590 Bytes
Versions: 51
Compression:
Stored size: 590 Bytes
Contents
module Micronaut module Matchers def has(sym, *args) # :nodoc: simple_matcher do |actual, matcher| matcher.failure_message = "expected ##{predicate(sym)}(#{args[0].inspect}) to return true, got false" matcher.negative_failure_message = "expected ##{predicate(sym)}(#{args[0].inspect}) to return false, got true" matcher.description = "have key #{args[0].inspect}" actual.__send__(predicate(sym), *args) end end private def predicate(sym) "#{sym.to_s.sub("have_","has_")}?".to_sym end end end
Version data entries
51 entries across 51 versions & 3 rubygems