I have the following action written:
# POST /designers.xml;contact def contact begin DesignerMailer.deliver_contact(params) rescue Exception => e logger.error("Email from #{params[:fromEmail]} to #{params[:toEmail]} errored with: #{e}") respond_to do |format| format.xml { render :xml => e.to_xml } end else respond_to do |format| format.xml { head :ok } end end end
As you can see, I follow a different path if there are errors in email delivery. My question?
How do I force that exception in a functional test? A simple mock is not sufficient since I only want the exception to occur in one of my tests. I've looked at the following code, but I'm not sure it fits what I need to do:
http://snippets.dzone.com/posts/show/1872 http://project.ioni.st/post/692#post-692
Thanks in advance!