MockRelation A chainable mock object for making assertions about ActiveRecord::Relation instances. Further reading. Installation Add this line to your application's Gemfile: gem 'mock_relation' And then execute: $ bundle Or install it yourself as: $ gem install mock_relation