Mocha: does_not_expect

F

Fernando Perez

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?
 
B

Ben Lovell

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

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?
some_object.expects:)expected_method).never

Regards,
Ben
 
B

Ben Lovell

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

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

Thank you very much.


Yeah I missed it first time round too :)

Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top