[rspec-users] matcher for bad request

drewB dbatshaw at gmail.com
Thu Apr 1 14:03:42 EDT 2010


Thanks!

On Mar 31, 11:37 pm, David Chelimsky <dchelim... at gmail.com> wrote:
> 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
>
> _______________________________________________
> rspec-users mailing list
> rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users


More information about the rspec-users mailing list