Class: Mocktail::Matchers::That
- Extended by:
- T::Sig
- Defined in:
- lib/mocktail/matchers/that.rb,
lib/mocktail/sorbet/mocktail/matchers/that.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(&blk) ⇒ That
constructor
A new instance of That.
- #inspect ⇒ Object
- #match?(actual) ⇒ Boolean
Methods inherited from Base
Constructor Details
#initialize(&blk) ⇒ That
Returns a new instance of That.
9 10 11 12 13 14 |
# File 'lib/mocktail/matchers/that.rb', line 9 def initialize(&blk) if blk.nil? raise ArgumentError.new("The `that` matcher must be passed a block (e.g. `that { |arg| … }`)") end @blk = blk end |
Class Method Details
.matcher_name ⇒ Object
5 6 7 |
# File 'lib/mocktail/matchers/that.rb', line 5 def self.matcher_name :that end |
Instance Method Details
#inspect ⇒ Object
22 23 24 |
# File 'lib/mocktail/matchers/that.rb', line 22 def inspect "that {…}" end |
#match?(actual) ⇒ Boolean
16 17 18 19 20 |
# File 'lib/mocktail/matchers/that.rb', line 16 def match?(actual) @blk.call(actual) rescue false end |