[rspec-users] expecting one of two conditions

Robert Poor rdpoor at gmail.com
Sun Mar 10 02:04:23 UTC 2013

On Sat, Mar 9, 2013 at 4:24 PM, Adam Sroka <adam.sroka at 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!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20130309/d96a072b/attachment.html>

More information about the rspec-users mailing list