Matcher for bad request

Is there a built-in matcher for a response returning a bad request
(e.g. header code in the 400s)? For example, “response.should
be_bad_request”.

On Apr 1, 2010, at 1:30 AM, drewB wrote:

Is there a built-in matcher for a response returning a bad request
(e.g. header code in the 400s)? For example, “response.should
be_bad_request”.

No, but its dead simple to write your own:

Spec::Matchers.define :be_bad_request do
match do |response|
response.code.to_s =~ /^4/
end
end

Thanks!