Lesson

Test ActiveRecord Named Scopes

Learn how to test ActiveRecord named scopes using RSpec.

Duration
2 min
Access
Free
Transcript
Needs source

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.