[rspec-devel] Stub patch

David Chelimsky dchelimsky at gmail.com
Fri Sep 22 07:50:48 EDT 2006

On 9/22/06, Brian Takita <brian.takita at gmail.com> wrote:
> Hello,
> I added a patch that adds stubbing support to rspec.
> http://rubyforge.org/tracker/index.php?func=detail&aid=5844&group_id=797&atid=3151
> 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
> It also resets the object to its prestubb state after the spec is finished.
> This would allow stubbing of class methods like Stubby or flexstub.

This is beautiful. Thanks Brian. I started to commit it but there are
a bunch of new warnings and coverage went down to by 3%. If you can
eliminate the warnings and address the coverage issues and get "rake
pre_commit" to run, feel free to commit this. Otherwise I'll look at
it as time allows, but that won't likely be for a couple of days.

Thanks again. This is great.


> Brian
> _______________________________________________
> rspec-devel mailing list
> rspec-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-devel

More information about the rspec-devel mailing list