Class: Mocktail::ExplainsNils
- Inherits:
-
Object
- Object
- Mocktail::ExplainsNils
- Extended by:
- T::Sig
- Defined in:
- lib/mocktail/explains_nils.rb,
lib/mocktail/sorbet/mocktail/explains_nils.rb
Instance Method Summary collapse
- #explain ⇒ Object
-
#initialize ⇒ ExplainsNils
constructor
A new instance of ExplainsNils.
Constructor Details
#initialize ⇒ ExplainsNils
Returns a new instance of ExplainsNils.
8 9 10 11 |
# File 'lib/mocktail/explains_nils.rb', line 8 def initialize @stringifies_method_name = StringifiesMethodName.new @stringifies_call = StringifiesCall.new end |
Instance Method Details
#explain ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/mocktail/explains_nils.rb', line 13 def explain Mocktail.cabinet..map { || dry_call = .call other_stubbings = .other_stubbings UnsatisfyingCallExplanation.new(, <<~MSG) `nil' was returned by a mocked `#{@stringifies_method_name.stringify(dry_call)}' method because none of its configured stubbings were satisfied. The actual call: #{@stringifies_call.stringify(dry_call, always_parens: true)} The call site: #{.backtrace.first} #{@stringifies_call.stringify_multiple(other_stubbings.map(&:recording), nonzero_message: "Stubbings configured prior to this call but not satisfied by it", zero_message: "No stubbings were configured on this method")} MSG } end |