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

noreply at rubyforge.org noreply at rubyforge.org
Wed Sep 27 15:59:26 EDT 2006


Patches item #5844, was opened at 2006-09-22 03: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: Accepted
Priority: 3
Submitted By: Brian Takita (btakita)
Assigned to: Brian Takita (btakita)
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

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

>Comment By: Aslak Hellesoy (aslak_hellesoy)
Date: 2006-09-27 15:59

Message:
I'm reopening this since it's reverted from trunk and now lives in branches/stubs until we're happy with the API and docs are written.

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

Comment By: David Chelimsky (dchelimsky)
Date: 2006-09-22 08:53

Message:
Committed in revision 786

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

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