Ruby on Rails Saturday, July 15, 2017

I'm a novice at Rspec.


Let's say I have
expect(response).to have_http_status(200)

But what I want is to say that either 200 or 302 is valid.

How would I do that?


Assume
(byebug) response.status
302

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) .


Is this the right forum to ask this question?

--
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/11fe797f-b3d2-484b-bdc3-ebf3410edbe9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment