Class: Mocktail::VerifiesCall

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/mocktail/verifies_call.rb,
lib/mocktail/sorbet/mocktail/verifies_call.rb

Instance Method Summary collapse

Constructor Details

#initializeVerifiesCall

Returns a new instance of VerifiesCall.



9
10
11
12
13
# File 'lib/mocktail/verifies_call.rb', line 9

def initialize
  @records_demonstration = RecordsDemonstration.new
  @finds_verifiable_calls = FindsVerifiableCalls.new
  @raises_verification_error = RaisesVerificationError.new
end

Instance Method Details

#verify(demo, demo_config) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/mocktail/verifies_call.rb', line 15

def verify(demo, demo_config)
  recording = @records_demonstration.record(demo, demo_config)
  verifiable_calls = @finds_verifiable_calls.find(recording, demo_config)

  unless verification_satisfied?(verifiable_calls.size, demo_config)
    @raises_verification_error.raise(recording, verifiable_calls, demo_config)
  end
  nil
end