lib/mocha/instance_method.rb in mocha-1.9.0 vs lib/mocha/instance_method.rb in mocha-1.10.0.alpha
- old
+ new
@@ -1,6 +1,23 @@
-require 'mocha/class_method'
+require 'mocha/stubbed_method'
module Mocha
- class InstanceMethod < ClassMethod
+ class InstanceMethod < StubbedMethod
+ private
+
+ def mock_owner
+ stubbee
+ end
+
+ def method_body(method)
+ PRE_RUBY_V19 ? proc { |*args, &block| method.call(*args, &block) } : method
+ end
+
+ def stubbee_method(method_name)
+ stubbee._method(method_name)
+ end
+
+ def original_method_owner
+ stubbee.singleton_class
+ end
end
end