Exception: Assay::MatchFailure
- Inherits:
-
CompareFailure
- Object
- Exception
- Assertion
- CompareFailure
- Assay::MatchFailure
- Defined in:
- lib/assay/assertions/match_failure.rb
Constant Summary
Constants inherited from Assertion
Class Method Summary collapse
- .assertable_method ⇒ Object
- .assertion_name ⇒ Object
- .assertion_operator ⇒ Object
-
.fail?(exp, act) ⇒ Boolean
Check negated assertion.
-
.pass?(exp, act) ⇒ Boolean
Check assertion.
Instance Method Summary collapse
Methods inherited from Assertion
#assert, assert, #assertion?, #fail?, #initialize, #negative?, #pass?, refute, #refute, #set_arguments, #set_negative, to_matcher
Constructor Details
This class inherits a constructor from Assay::Assertion
Class Method Details
.assertable_method ⇒ Object
26 27 28 |
# File 'lib/assay/assertions/match_failure.rb', line 26 def self.assertable_method :assert_match end |
.assertion_name ⇒ Object
7 8 9 |
# File 'lib/assay/assertions/match_failure.rb', line 7 def self.assertion_name :match end |
.assertion_operator ⇒ Object
11 12 13 |
# File 'lib/assay/assertions/match_failure.rb', line 11 def self.assertion_operator :=~ end |
.fail?(exp, act) ⇒ Boolean
Check negated assertion.
21 22 23 |
# File 'lib/assay/assertions/match_failure.rb', line 21 def self.fail?(exp, act) exp !~ act end |
.pass?(exp, act) ⇒ Boolean
Check assertion.
16 17 18 |
# File 'lib/assay/assertions/match_failure.rb', line 16 def self.pass?(exp, act) exp =~ act end |
Instance Method Details
#to_s ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/assay/assertions/match_failure.rb', line 31 def to_s return @mesg if @mesg return super unless @arguments.size == 2 exp = @arguments[0].inspect act = @arguments[1].inspect if @_negated "Expected #{act} !~ #{exp}" else "Expected #{act} =~ #{exp}" end end |