Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    Test ActiveRecord Named Scopes

    railsRuby on Rails

    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.