[rspec-devel] [ rspec-Feature Requests-9984 ] Unmock methods
noreply at rubyforge.org
noreply at rubyforge.org
Mon Apr 9 02:36:02 EDT 2007
Feature Requests item #9984, was opened at 2007-04-08 23:36
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=9984&group_id=797
Category: None
Group: None
Status: Open
Priority: 3
Submitted By: Brian Takita (btakita)
Assigned to: Nobody (None)
Summary: Unmock methods
Initial Comment:
This would apply to partial mocks.
Thes use case is:
By default, I want a certain object to be mocked because the method that is called is very slow. However, I do want to test it's implementation in a few specs.
Currently this works:
class ObjectWithLongMethod
def long_method
'this takes a long time'
end
end
obj = ObjectWithLongMethod.new
obj.stub!(:long_method).and_return('my string')
obj.long_method.should == 'my string'
obj.stub!(:long_method).and_return &obj.method(:proxied_by_rspec__long_method)
obj.long_method.should == 'this takes a long time'
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=3152&aid=9984&group_id=797
More information about the rspec-devel
mailing list