Setup Shoulda matchers in Rails
11 March 2022 (Updated 11 March 2022)
On this page
Install gem
Add to Gemfile:
Run:
Configure with RSpec
Create spec/support/shoulda_matchers.rb
:
Make sure this file is included from your rails_helper.rb
or spec_helper.rb
.
Use in tests
For example, a spec/models/user_spec.rb
file might have:
Sources
Tagged:
Rails testing
Thanks for your comment . Once it's approved, it will appear here.
Leave a comment