A quick monkey patch for use within Rails request specs. Adds boolean methods like ok?
, not_found?
, and unauthorized?
to allow querying the name of a response status rather than its code. Within RSpec, expections can be specified easily as be_ok
, be_not_found
, and be_unauthorized
. Like in a Rails action:
respond_with @some_object, status: 201
In my opinion, the above doesn't read as well as this:
respond_with @some_object, status: :created