Class: Mocktail::Matchers::That

Inherits:
Base
  • Object
show all
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

Methods inherited from Base

#is_mocktail_matcher?

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_nameObject



5
6
7
# File 'lib/mocktail/matchers/that.rb', line 5

def self.matcher_name
  :that
end

Instance Method Details

#inspectObject



22
23
24
# File 'lib/mocktail/matchers/that.rb', line 22

def inspect
  "that {…}"
end

#match?(actual) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
19
20
# File 'lib/mocktail/matchers/that.rb', line 16

def match?(actual)
  @blk.call(actual)
rescue
  false
end