Skip to content

Instantly share code, notes, and snippets.

@demetrios
demetrios / rspec_rails_cheetsheet.rb
Created October 23, 2018 06:34 — forked from redrick/rspec_rails_cheetsheet.rb
New expect syntax + new hash syntax and couple corrections
#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
expect(response).to redirect_to(movies_path)