What Can You Do in a Model Test?

An RSpec file in the spec/models directory is automatically of type: :model, which gives you … not a whole lot of new behavior, actually. An add-on gem called rspec-activemodel-mocks,[13] which is maintained by the RSpec core team, includes some mock-object tools specific to use with ActiveModel.

Get Rails 5 Test Prescriptions now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.