Flowdock
method

stub_object

Importance_1
v7.1.3.2 - Show latest stable - 0 notes - Class: SimpleStubs
stub_object(object, method_name, &block) public

Stubs object.method_name with the given block If the method is already stubbed, remove that stub so that removing this stub will restore the original implementation.

Time.current # => Sat, 09 Nov 2013 15:34:49 EST -05:00
target = Time.zone.local(2004, 11, 24, 1, 4, 44)
simple_stubs.stub_object(Time, :now) { at(target.to_i) }
Time.current # => Wed, 24 Nov 2004 01:04:44 EST -05:00
Show source
Register or log in to add new notes.