Ruby on Rails Saturday, July 15, 2017

Very close!

expect([200, 302]).to include response.status

Thank you so much!  Your suggestion gave me a whole new understanding of Rspec

Ralph


On Saturday, July 15, 2017 at 7:48:49 PM UTC-6, Dave Aronson wrote:
On Saturday, July 15, 2017, Ralph Shnelvar <ralphs@dos32.com> wrote:

I've tried
expect(response).to (have_http_status(200) || have_http_status(302))

While syntactically valid, this doesn't work because have_http_status(200)will throw an exception before it gets to the have_http_status(302) .

Maybe something like "expect([200, 302]).to include response.status_code"?  (Not sure of exact syntax as I've been away from RSpec for a while and am not at my coding computer.)


--
Sent from Gmail Mobile; please excuse top posting, typos, etc. :-(

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/62013409-cdce-4088-a4f0-bba5d2b51406%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment