RSpec / RSpec Rails / Docs
Matchers
rspec-rails offers a number of custom matchers, most of which are rspec-compatible wrappers for Rails' assertions.
redirects
# delegates to assert_redirected_to
expect(response).to redirect_to(path)templates
# 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)In this section
- be_a_new matcher
- render_template matcher
- redirect_to matcher
have_http_statusmatcher- ActiveRecord::Relation match array
- have_been_enqueued matcher
- have_been_performed matcher
- have_broadcasted matcher
- have_enqueued_job matcher
- have_enqueued_mail matcher
- have_performed_job matcher
- have_stream_from matcher
Source: features/matchers/README.md at v5.1.2, RSpec Rails (MIT license).