Flowdock
method

stub_object

Importance_0
v4.2.7 - Show latest stable - 0 notes - Class: SimpleStubs
stub_object(object, method_name, return_value) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activesupport/lib/active_support/testing/time_helpers.rb, line 10
      def stub_object(object, method_name, return_value)
        key = [object.object_id, method_name]

        if stub = @stubs[key]
          unstub_object(stub)
        end

        new_name = "__simple_stub__#{method_name}"

        @stubs[key] = Stub.new(object, method_name, new_name)

        object.singleton_class.send :alias_method, new_name, method_name
        object.define_singleton_method(method_name) { return_value }
      end
Register or log in to add new notes.