Class: Mocktail::RaisesNeatoNoMethodError

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

Instance Method Summary collapse

Constructor Details

#initializeRaisesNeatoNoMethodError

Returns a new instance of RaisesNeatoNoMethodError.



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

def initialize
  @stringifies_call = StringifiesCall.new
  @stringifies_method_name = StringifiesMethodName.new
  @creates_identifier = CreatesIdentifier.new
end

Instance Method Details

#call(call) ⇒ Object

Raises:

  • (NoMethodError)


15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/mocktail/raises_neato_no_method_error.rb', line 15

def call(call)
  raise NoMethodError, <<~MSG, caller[1..]
    No method `#{@stringifies_method_name.stringify(call)}' exists for call:

      #{@stringifies_call.stringify(call, anonymous_blocks: true, always_parens: true)}

    Need to define the method? Here's a sample definition:

      def #{"self." if call.singleton}#{call.method}#{params(call)}
      end
    #{corrections(call)}
  MSG
end