Class: Lookout::Mock::Methods

Inherits:
Stub::Methods show all
Defined in:
lib/lookout/mock/methods.rb

Instance Method Summary collapse

Methods inherited from Stub::Methods

#initialize, #undefine

Constructor Details

This class inherits a constructor from Lookout::Stub::Methods

Instance Method Details

#define(object, method, *args, &block) ⇒ Object

Raises:

  • (RuntimeError)


4
5
6
7
8
9
10
11
# File 'lib/lookout/mock/methods.rb', line 4

def define(object, method, *args, &block)
  method = Lookout::Mock::Method.new(object, method, *args, &block)
  raise RuntimeError,
    '%s: cannot create mock as a mock has already been created: %s' %
      [method, @methods.first] unless @methods.empty?
  @methods << method.define
  method
end