b) makes sense, though it is surprising:  I mean developer-defined
errors are usually Exceptions, and should be caught too, no ?  I need
to pick up my ruby book again.

Elise

On Oct 31, 10:05 am, "James Mead" <[EMAIL PROTECTED]> wrote:
> Hi Elise,
>
> 2008/10/31 [EMAIL PROTECTED] <[EMAIL PROTECTED]>
>
> > - mocking (ok, i'm using mocha, so maybe it isn't rspec):  i make a
> > mailer raise an error like this:
> > DummyMailer.stubs(:deliver_invitation).raises(Exception)
> > and in my code, surround this with begin ... rescue, the exception is
> > not caught !
>
> a) Are you sure deliver_invitation is being called?
> b) Are you using just a default rescue clause? This will only rescue
> StandardError's and descendants of StandardError. Exception is not a
> descendant of StandardError. I think Mocha raises a StandardError by
> default, so if you change your stubbing as follows, a default rescue clause
> will work...
>
>   DummyMailer.stubs(:deliver_invitation).raises
>
> If you are still seeing unexpected behaviour, come over to the Mocha mailing
> list [1] and we'll see if we can help.
>
> --
> James.http://blog.floehopper.org
>
> [1]http://groups.google.com/group/mocha-developer
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to