File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Ruby and the fly likes Problems testing a destroy failure Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Languages » Ruby
Bookmark "Problems testing a destroy failure" Watch "Problems testing a destroy failure" New topic
Author

Problems testing a destroy failure

Eric Hermann
Greenhorn

Joined: May 07, 2013
Posts: 6
Hello,
I'm trying to test an active record object destroy failure but I'm having problems creating a failure situation. I have a before_filter method called 'require_user_payment_info' which validates the @payment_info object before the delete method is called so I can't create a 'bad' @payment_info object before the delete method is called.

Here's the require_user_payment_info method:




And the actual delete method:



Any ideas?

Thanks!
Eric Hermann
Greenhorn

Joined: May 07, 2013
Posts: 6
Bingo - here's my solution:



Thanks for your help!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problems testing a destroy failure