Sha256: 3aa0bc95312d7299d5658674c0f645a059018c69d7817d6f8594a55f86d70e39
Contents?: true
Size: 754 Bytes
Versions: 41
Compression:
Stored size: 754 Bytes
Contents
module RSpec module Matchers class Has def initialize(expected, *args) @expected, @args = expected, args end def matches?(actual) actual.__send__(predicate(@expected), *@args) end def failure_message_for_should "expected ##{predicate(@expected)}(#{@args[0].inspect}) to return true, got false" end def failure_message_for_should_not "expected ##{predicate(@expected)}(#{@args[0].inspect}) to return false, got true" end def description "have key #{@args[0].inspect}" end private def predicate(sym) "#{sym.to_s.sub("have_","has_")}?".to_sym end end end end
Version data entries
41 entries across 41 versions & 4 rubygems