Sha256: 1ef56f01ff299baf3b31045abeac439aa4b1088726055a29c1dc6f5d45d2eb30
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
require_relative "share/stringifies_method_name" require_relative "share/stringifies_call" module Mocktail class ExplainsNils extend T::Sig def initialize @stringifies_method_name = StringifiesMethodName.new @stringifies_call = StringifiesCall.new end def explain Mocktail.cabinet.unsatisfying_calls.map { |unsatisfying_call| dry_call = unsatisfying_call.call other_stubbings = unsatisfying_call.other_stubbings UnsatisfyingCallExplanation.new(unsatisfying_call, <<~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: #{unsatisfying_call.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 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mocktail-2.0.0 | lib/mocktail/explains_nils.rb |