On Sat, Mar 9, 2013 at 4:24 PM, Adam Sroka <adam.sr...@gmail.com> wrote:

> It depends on what you really mean:
>
> 1) If you care that it is either OneError or OtherError, then these are
> two separate scenarios and should be written as such.
>
> 2) If you don't care which one it is, then you probably just be less
> specific. Is there a common message they respond to that you could check
> for?
>
> 3) If you care which error you are getting, but you don't want to have to
> check for each one, then you might consider wrapping the error with
> something easier to inspect.
>
> There are probably a number of other good answers too, depending on which
> smell is bugging you the most.
>

I don't care which error I'm getting, so suggestion 2) works.  The errors I
expect are within a specific module (UpdateOrInsert::), so I could simply
check for that.  Not sure how do to that short of parsing the class name
string (e.g. error_class.name.split("::")), but I'm not sure that is less
smelly than the code I already have.

I'll contemplate 3), which could make life easer.  Thanks!
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to