Patches: Browse | Submit New | Admin

[#5844] Stub method

Date:
2006-09-22 07:50
Priority:
3
Submitted By:
Brian Takita (btakita)
Assigned To:
Brian Takita (btakita)
Category:
None
State:
Closed
Summary:
Stub method

Detailed description
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

Add A Comment: Notepad

Please login


Followup

Message
Date: 2006-09-27 19:59
Sender: Aslak Hellesøy

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.
Date: 2006-09-22 12:53
Sender: David Chelimsky

Committed in revision 786

Attached Files:

Name Description Download
rspec_stub.patch Download

Changes:

Field Old Value Date By
close_date2006-10-14 03:402006-10-14 03:40btakita
status_idOpen2006-10-14 03:40btakita
status_idClosed2006-09-27 19:59aslak_hellesoy
assigned_tonone2006-09-22 12:53dchelimsky
close_date2006-09-22 12:532006-09-22 12:53dchelimsky
status_idOpen2006-09-22 12:53dchelimsky
resolution_idNone2006-09-22 12:53dchelimsky
File Added815: rspec_stub.patch2006-09-22 07:50btakita