Class: Mocktail::DescribesUnsatisfiedStubbing

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

Instance Method Summary collapse

Constructor Details

#initializeDescribesUnsatisfiedStubbing

Returns a new instance of DescribesUnsatisfiedStubbing.



8
9
10
# File 'lib/mocktail/handles_dry_call/fulfills_stubbing/describes_unsatisfied_stubbing.rb', line 8

def initialize
  @cleans_backtrace = CleansBacktrace.new
end

Instance Method Details

#describe(dry_call) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/mocktail/handles_dry_call/fulfills_stubbing/describes_unsatisfied_stubbing.rb', line 12

def describe(dry_call)
  UnsatisfyingCall.new(
    call: dry_call,
    other_stubbings: Mocktail.cabinet.stubbings.select { |stubbing|
      Bind.call(dry_call.double, :==, stubbing.recording.double) &&
        dry_call.method == stubbing.recording.method
    },
    backtrace: @cleans_backtrace.clean(Error.new).backtrace || []
  )
end