Test ActiveRecord Named Scopes

Victor Hazbun
InstructorVictor Hazbun

Share this video with your friends

Send Tweet

Learn how to test ActiveRecord named scopes using RSpec.

In this lesson, we will test a User model that will have a by_ci_email method that we will define on the model. We will test this method in our user_spec.rb file and pass in a lower case email argument to demonstrate that the by_ci_email method is functioning correctly by finding the correct user.