Sha256: a479da47c46180a29ebbe7f2e24f2bf4df9d0825870fab37a05c4da00b520c6d
Contents?: true
Size: 587 Bytes
Versions: 16
Compression:
Stored size: 587 Bytes
Contents
module Spec 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
16 entries across 16 versions & 4 rubygems