Sha256: 532f5b28fd184ce9687eba597fc1b2760c674e8c2c637f0cd4b61b44d49b47e6
Contents?: true
Size: 752 Bytes
Versions: 1
Compression:
Stored size: 752 Bytes
Contents
# encoding: utf-8 module CustomMatchers class BreakDownTo def initialize(expected) @expected = expected end def matches?(target) @target = target @failed = false @expected.each_pair do |k,v| unless @target.send(k) == @expected[k] @failed = k end end !@failed end def failure_message "expected #{@failed} to be |#{@expected[@failed]}| " + "but was |#{@target.send(@failed)}|" end def megative_failure_message "expected #{@failed} not to be |#{@expected[@failed]}| " + "and was |#{@target.send(@failed)}|" end end # Actual matcher that is exposed. def break_down_to(expected) BreakDownTo.new(expected) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rack-mail_exception-0.0.1 | vendor/mail/spec/matchers/break_down_to.rb |