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?

(byebug) response.status

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
To post to this group, send email to
To view this discussion on the web visit
For more options, visit

No comments:

Post a Comment