Logo: Relish

  1. Sign in

Project: RSpec Rails 5.0


rspec-rails offers a number of custom matchers, most of which are
rspec-compatible wrappers for Rails' assertions.


# delegates to assert_redirected_to
expect(response).to redirect_to(path)


# delegates to assert_template
expect(response).to render_template(template_name)

assigned objects

# passes if assigns(:widget) is an instance of Widget
# and it is not persisted
expect(assigns(:widget)).to be_a_new(Widget)


  1. be_a_new matcher
  2. render_template matcher
  3. redirect_to matcher
  4. `have_http_status` matcher
  5. ActiveRecord::Relation match array
  6. have_been_enqueued matcher
  7. have_been_performed matcher
  8. have_broadcasted matcher
  9. have_enqueued_job matcher
  10. have_enqueued_mail matcher
  11. have_performed_job matcher
  12. have_stream_from matcher

Last published 9 months ago by Jon Rowe.