This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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
 
Similar Threads
Passing objects across controllers in Grails
Deleting file after method throws exception
Trasactions in EJB
Grails Webflows
Groovy, Java, and the value of an IDE