Flowdock
method

stub_object

Importance_0
v5.1.7 - Show latest stable - 0 notes - Class: SimpleStubs
stub_object(object, method_name, &block) 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 14
      def stub_object(object, method_name, &block)
        if stub = stubbing(object, method_name)
          unstub_object(stub)
        end

        new_name = "__simple_stub__#{method_name}"

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

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