Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I unstub in rspec 3 without enabling the old syntax?

Tags:

I am upgrading from rspec 2 to rspec 3 and would like to use the new syntax and not enable the old syntax. But I have a few stubs that I set up in my top-level before(:each) block that I selectively unstub where I want the original implementation.

Is there some equivalent way to remove a stub when I've defined it with the new allow syntax?

like image 586
Kevin Bullaughey Avatar asked Jun 23 '14 18:06

Kevin Bullaughey


1 Answers

You could redifine them with

expect(Person).to receive(:find).and_call_original 

which will additionaly check that the original :find method was called on person

like image 89
dre-hh Avatar answered Nov 06 '22 05:11

dre-hh