Skip to content

Instantly share code, notes, and snippets.

mlr / rspec_rails_cheetsheet.rb
Last active Feb 25, 2021 — forked from them0nk/rspec_rails_cheetsheet.rb
Rspec Rails cheatsheet with expect syntax (including capybara matchers)
View rspec_rails_cheetsheet.rb
# Model
expect(@user).to have(1).error_on(:username) # checks whether there is an error in username
expect(@user.errors[:username]).to include("can't be blank") # check for the error message
# Rendering
expect(response).to render_template(:index)
# Redirecting