Permalink
Browse files

Adds #bad_request? helper

  • Loading branch information...
1 parent f6ee254 commit 533a1a90d0e3bccfecb69ebf10750b36d54d4553 @alindeman alindeman committed Oct 25, 2011
Showing with 6 additions and 0 deletions.
  1. +1 −0 lib/rack/response.rb
  2. +5 −0 test/spec_response.rb
View
@@ -121,6 +121,7 @@ def client_error?; status >= 400 && status < 500; end
def server_error?; status >= 500 && status < 600; end
def ok?; status == 200; end
+ def bad_request?; status == 400; end
def forbidden?; status == 403; end
def not_found?; status == 404; end
View
@@ -208,6 +208,11 @@
res.should.be.successful
res.should.be.ok
+ res.status = 400
+ res.should.not.be.successful
+ res.should.be.client_error
+ res.should.be.bad_request
+
res.status = 404
res.should.not.be.successful
res.should.be.client_error

0 comments on commit 533a1a9

Please sign in to comment.