[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Mocha: does_not_expect

Fernando Perez

4/17/2009 12:10:00 PM

Hi,

I am writing tests for a Rails app using Test::Unit and Mocha. expects
does a great job to make sure a method is called. But how to handle the
fact that a method shouldn't be called?

I have a before filter that protects the call to a given restricted
method, and how to make sure that this method doesn't get called
unexpectedly?
--
Posted via http://www.ruby-....

3 Answers

Ben Lovell

4/17/2009 12:24:00 PM

0

[Note: parts of this message were removed to make it a legal post.]

On Fri, Apr 17, 2009 at 1:09 PM, Fernando Perez <pedrolito@lavache.com>wrote:

> Hi,
>
> I am writing tests for a Rails app using Test::Unit and Mocha. expects
> does a great job to make sure a method is called. But how to handle the
> fact that a method shouldn't be called?
>
> I have a before filter that protects the call to a given restricted
> method, and how to make sure that this method doesn't get called
> unexpectedly?
> --
> Posted via http://www.ruby-....
>
>
some_object.expects(:expected_method).never

Regards,
Ben

Fernando Perez

4/17/2009 12:35:00 PM

0


> some_object.expects(:expected_method).never

Damnd I never thought about such method while reading the API.

Thank you very much.
--
Posted via http://www.ruby-....

Ben Lovell

4/17/2009 12:40:00 PM

0

[Note: parts of this message were removed to make it a legal post.]

On Fri, Apr 17, 2009 at 1:34 PM, Fernando Perez <pedrolito@lavache.com>wrote:

>
> > some_object.expects(:expected_method).never
>
> Damnd I never thought about such method while reading the API.
>
> Thank you very much.


Yeah I missed it first time round too :)

Ben