Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Mocha: does_not_expect

Reply
Thread Tools

Mocha: does_not_expect

 
 
Fernando Perez
Guest
Posts: n/a
 
      04-17-2009
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-forum.com/.

 
Reply With Quote
 
 
 
 
Ben Lovell
Guest
Posts: n/a
 
      04-17-2009
[Note: parts of this message were removed to make it a legal post.]

On Fri, Apr 17, 2009 at 1:09 PM, Fernando Perez <(E-Mail Removed)>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-forum.com/.
>
>

some_object.expects(:expected_method).never

Regards,
Ben

 
Reply With Quote
 
 
 
 
Fernando Perez
Guest
Posts: n/a
 
      04-17-2009

> 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-forum.com/.

 
Reply With Quote
 
Ben Lovell
Guest
Posts: n/a
 
      04-17-2009
[Note: parts of this message were removed to make it a legal post.]

On Fri, Apr 17, 2009 at 1:34 PM, Fernando Perez <(E-Mail Removed)>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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments