Class: Spec::Matchers::SimpleMatcher

Class | Spec::Matchers::SimpleMatcher
In: | lib/spec/matchers/simple_matcher.rb
Parent: | Object

### Methods

failure_message matches? negative_failure_message new

### Attributes

description | [R] |

### Public Class methods

new(description, &match_block)

[Source]

       # File lib/spec/matchers/simple_matcher.rb, line 6
    6:       def initialize(description, &match_block)
    7:         @description = description
    8:         @match_block = match_block
    9:       end

### Public Instance methods

failure_message()

[Source]

        # File lib/spec/matchers/simple_matcher.rb, line 16
    16:       def failure_message()
    17:         return %[expected #{@description.inspect} but got #{@actual.inspect}]
    18:       end

matches?(actual)

[Source]

        # File lib/spec/matchers/simple_matcher.rb, line 11
    11:       def matches?(actual)
    12:         @actual = actual
    13:         return @match_block.call(@actual)
    14:       end

negative_failure_message()

[Source]

        # File lib/spec/matchers/simple_matcher.rb, line 20
    20:       def negative_failure_message()
    21:         return %[expected not to get #{@description.inspect}, but got #{@actual.inspect}]
    22:       end

[Validate]