In case of failure the normal should be_redirect and its friends are far from helpful…

expected redirect? to return true, got false

expected "new", got nil

Now you can have this:

Status should be redirect but was 200(success)
 - rendered addresses/new
 - Flash:
    :error = Address contains errors!
 - Errors:Errors on @address(Address):
     City can't be blank

Usage

  • response.should redirect_to / render_template as normal
  • response.should have_been_success (i do not want to overwrite be_success…)
  • have_been_error
  • have_been_missing
  • have_been_redirect

Install

script/plugin install git://github.com/grosser/rspec_response_enhancer.git

add to spec/spec_helper.rb:
Spec::Runner.configure do |config|
  ...
  config.include(RspecResponseEnhancer)
  ...
end

And as added benefit you no longer need to build should be_success when you already have a should render_template, since render_template now gives detailed error messages!