[rspec-users] How to do controller.stub(:some_method) at request test when using rspec2

Jiang Guimin lists at ruby-forum.com
Tue Mar 8 03:45:18 EST 2011


Rob Aldred wrote in post #985198:
> On 3 Mar 2011, at 07:36, Jiang Guimin wrote:
>
>>   end
>>      controller.should_receive(:save_u_and_node).with(table,
>>
>> rspec-users mailing list
>> rspec-users at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/rspec-users
>
>
> Are you wanting to stub a method of the controller you are actually
> testing?
> I'm pretty sure this is bad practice.

You are right, it's bad practice, i got nightmare because of
"save_u_and_node". "save_u_and_node" is a huge code block that was
written by my colleagues some months ago, and i need add some features
based at "save_u_and_node", but i can't find any spec codes for
"save_u_and_node", so i had to stub "save_u_and_node" in controller
roughly in order to  pass spec.
 Thanks
 This forum's email notification featrue seems dosen't work

-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list