lib/mocha/instance_method.rb in mocha-0.5.6 vs lib/mocha/instance_method.rb in mocha-0.9.0
- old
+ new
@@ -1,8 +1,17 @@
require 'mocha/class_method'
module Mocha
class InstanceMethod < ClassMethod
+
+ def method_exists?(method)
+ existing_methods = []
+ existing_methods += stubbee.public_methods(false)
+ existing_methods += stubbee.protected_methods(false)
+ existing_methods += stubbee.private_methods(false)
+ existing_methods.any? { |m| m.to_s == method.to_s }
+ end
+
end
end
\ No newline at end of file