Keeps backwards compatibility since we had released an rspec-mocks that only supported stubbing. Later, we released the hide_const feature and decided that the term "mutator" was a better term to wrap up the concept of both stubbing and hiding.
@api private
# File lib/rspec/mocks.rb, line 26 def configuration @configuration ||= Configuration.new end
@api private Used internally to get a method handle for a particular object and method name.
Includes handling for a few special cases:
- Objects that redefine #method (e.g. an HTTPRequest struct) - BasicObject subclasses that mixin a Kernel dup (e.g. SimpleDelegator)
# File lib/rspec/mocks.rb, line 49 def method_handle_for(object, method_name) if ::Kernel === object KERNEL_METHOD_METHOD.bind(object).call(method_name) else object.method(method_name) end end
# File lib/rspec/mocks.rb, line 10 def setup(host) add_extensions unless extensions_added? (class << host; self; end).class_eval do include RSpec::Mocks::ExampleMethods end self.space ||= RSpec::Mocks::Space.new end
# File lib/rspec/mocks.rb, line 22 def teardown space.reset_all end
@api private Used internally by RSpec to display custom deprecation warnings. This is also defined in rspec-core, but we can't assume it's loaded since rspec-expectations should be usable w/o rspec-core.
# File lib/rspec/mocks.rb, line 34 def warn_deprecation(message) warn(message) end
Generated with the Darkfish Rdoc Generator 2.