Thanks, Jon. That makes a lot of sense. I wasn't specifically looking for "missing" but "generic error that isn't a server error". This has made me think a bit more about the exact status code I want and that is probably good practice anyway.
With the Internet of Things it is not too hard to imagine a legitimate use for a 418 status. :-) On Wed, 26 Feb 2020 at 16:05, Jon Rowe <[email protected]> wrote: > Hi Joseph > > TL;DR because rails does. > > Partly because we take the lead from rails here and provide only some > fuzzing around the versions to provide consistency… Rails takes this strict > approach because only 404 is missing, most of the other 4xx status codes > are other kinds of client errors. I suppose you could argue that 410 (Gone) > is missing, but then we get into semantic errors. I can assure you that 401 > / 403 is not missing, nor 405 and most definitely not 418. Even if I do > sometimes misplace the teapot. > > Cheers > Jon Rowe > --------------------------- > [email protected] > jonrowe.co.uk > > On 26 February 2020 at 15:01, Joseph Haig wrote: > > I am looking at the documentation for the have_http_status matcher here - > https://www.rubydoc.info/gems/rspec-rails/RSpec%2FRails%2FMatchers:have_http_status > - > and I see that there are options to match for 2xx (:success), 3xx > (:redirect) and 5xx (:error) but if I use :missing then it matches exactly > on a 404 status. Is there any particular reason why there isn't an option > for matching a status in the range 400-499? Thanks. > > Regards, > > Joe > > -- > You received this message because you are subscribed to the Google Groups > "rspec" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/rspec/dejalu-217-e06f5c2a-aae8-45d0-b63d-12c064648ed3%40jonrowe.co.uk > <https://groups.google.com/d/msgid/rspec/dejalu-217-e06f5c2a-aae8-45d0-b63d-12c064648ed3%40jonrowe.co.uk?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "rspec" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/CAKRXwc1RnN6H5d14%3DAO-ms3AGtGyBM4AR%3D_AHfSkuoQJUH9MWg%40mail.gmail.com.
