Class: Mocktail::Matchers::Base
- Inherits:
-
Object
- Object
- Mocktail::Matchers::Base
show all
- Extended by:
- T::Helpers, T::Sig
- Defined in:
- lib/mocktail/matchers/base.rb,
lib/mocktail/sorbet/mocktail/matchers/base.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(expected) ⇒ Base
Custom matchers can receive any args, kwargs, or block they want. Usually single-argument, though, so that’s defaulted here and in #insepct
13
14
15
|
# File 'lib/mocktail/matchers/base.rb', line 13
def initialize(expected)
@expected = expected
end
|
Class Method Details
.matcher_name ⇒ Object
17
18
19
|
# File 'lib/mocktail/matchers/base.rb', line 17
def self.matcher_name
raise Mocktail::InvalidMatcherError.new("The `matcher_name` class method must return a valid method name")
end
|
Instance Method Details
#inspect ⇒ Object
25
26
27
|
# File 'lib/mocktail/matchers/base.rb', line 25
def inspect
"#{self.class.matcher_name}(#{@expected.inspect})"
end
|
#is_mocktail_matcher? ⇒ Boolean
29
30
31
|
# File 'lib/mocktail/matchers/base.rb', line 29
def is_mocktail_matcher?
true
end
|
#match?(actual) ⇒ Boolean
21
22
23
|
# File 'lib/mocktail/matchers/base.rb', line 21
def match?(actual)
raise Mocktail::InvalidMatcherError.new("Matchers must implement `match?(argument)`")
end
|