[rspec-devel] [ rspec-Patches-5844 ] Stub method

noreply at rubyforge.org noreply at rubyforge.org
Fri Sep 22 03:50:55 EDT 2006


Patches item #5844, was opened at 2006-09-22 00:50
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3151&aid=5844&group_id=797

Category: None
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Brian Takita (btakita)
Assigned to: Nobody (None)
Summary: Stub method

Initial Comment:
This patch allows objects to be stubbed. It also reverts the object to its unstubbed state after the spec is finished executing.

For example:

require File.dirname(__FILE__) + '/../lib/spec'

context "A consumer of a stub" do

  specify "should be able to stub objects" do
    obj = Object.new
    stub(obj).method(:foobar).with {:return_value}
    obj.foobar.should_equal :return_value
  end

end

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3151&aid=5844&group_id=797


More information about the rspec-devel mailing list