Sha256: 01337ab3d4960cb04595f2469aed60afadb8242679003af9f998069e447d51ae
Contents?: true
Size: 1.06 KB
Versions: 47
Compression:
Stored size: 1.06 KB
Contents
module Spec module Matchers class Has #:nodoc: def initialize(sym, *args) @sym = sym @args = args end def matches?(target) @target = target begin return target.send(predicate, *@args) rescue => @error # This clause should be empty, but rcov will not report it as covered # unless something (anything) is executed within the clause rcov_error_report = "http://eigenclass.org/hiki.rb?rcov-0.8.0" end return false end def failure_message raise @error if @error "expected ##{predicate}(#{@args[0].inspect}) to return true, got false" end def negative_failure_message raise @error if @error "expected ##{predicate}(#{@args[0].inspect}) to return false, got true" end def description "have key #{@args[0].inspect}" end private def predicate "#{@sym.to_s.sub("have_","has_")}?".to_sym end end end end
Version data entries
47 entries across 47 versions & 8 rubygems