Permalink
Browse files

Add created? and accepted? response helper methods

  • Loading branch information...
tjmw committed Jan 26, 2014
1 parent 371cf6f commit 3db3f8080dbe43d29e7862ee0ee68bfe90b23d2c
Showing with 10 additions and 0 deletions.
  1. +2 −0 lib/rack/response.rb
  2. +8 −0 test/spec_response.rb
View
@@ -122,6 +122,8 @@ def client_error?; status >= 400 && status < 500; end
def server_error?; status >= 500 && status < 600; end
def ok?; status == 200; end
+ def created?; status == 201; end
+ def accepted?; status == 202; end
def bad_request?; status == 400; end
def unauthorized?; status == 401; end
def forbidden?; status == 403; end
View
@@ -223,6 +223,14 @@ def object_with_each.each
res.should.be.successful
res.should.be.ok
+ res.status = 201
+ res.should.be.successful
+ res.should.be.created
+
+ res.status = 202
+ res.should.be.successful
+ res.should.be.accepted
+
res.status = 400
res.should.not.be.successful
res.should.be.client_error

0 comments on commit 3db3f80

Please sign in to comment.