Class: MacSpec::MockingFramework::Mock
- Inherits:
-
Object
- Object
- MacSpec::MockingFramework::Mock
- Defined in:
- lib/mac_spec/mocking_framework/mock.rb
Instance Method Summary collapse
-
#initialize(name, options = {}) ⇒ Mock
constructor
A new instance of Mock.
Constructor Details
#initialize(name, options = {}) ⇒ Mock
Returns a new instance of Mock.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/mac_spec/mocking_framework/mock.rb', line 4 def initialize(name, ={}) (class<<self;self;end).instance_eval do if [:null_object] define_method :method_missing do |name, *args, &block| Mock.new(:null_object, :null_object => true) end end [:stubs] && [:stubs].each do |stub_method, return_value| define_method stub_method do |*args| return_value end end end end |