Exception: StubRequests::InvalidArgumentType

Inherits:
Error
  • Object
show all
Defined in:
lib/stub_requests/exceptions.rb

Overview

InvalidArgumentType is raised when an argument is not of the expected type

Since:

  • 0.1.0

Instance Method Summary collapse

Constructor Details

#initialize(name:, actual:, expected:) ⇒ InvalidArgumentType

Returns a new instance of InvalidArgumentType

Parameters:

  • name (Symbol)

    the name of the argument

  • actual (Object)

    the actual value of the argument

  • expected (Array<Class>, Array<Module>)

    the types the argument is expected to be

Since:

  • 0.1.0



61
62
63
# File 'lib/stub_requests/exceptions.rb', line 61

def initialize(name:, actual:, expected:)
  super("The argument `:#{name}` was `#{actual}`, expected any of [#{expected.join(', ')}]")
end