Class: Class

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec_ext/rspec.rb

Overview

Stubbing every instances of class.

Instance Method Summary collapse

Instance Method Details

#after_instantiate(&block) ⇒ Object



98
99
100
101
102
103
104
105
# File 'lib/rspec_ext/rspec.rb', line 98

def after_instantiate &block
  new_method = method :new
  stub! :new do |*args|
    instance = new_method.call *args
    block.call instance
    instance
  end
end