# How to Use Shoulda Matchers with RSpec for Ruby on Rails

DevFeed: [How to Use Shoulda Matchers with RSpec for Ruby on Rails](<https://devfeed.tech/articles/how-to-use-shoulda-matchers-with-rspec-for-ruby-on-rails-77081.md>)

Original publisher: [Read original article](<https://blog.appsignal.com/2023/12/06/how-to-use-shoulda-matchers-with-rspec-for-ruby-on-rails.html>)

Author: Kingsley Chijioke

Published: 2023-12-06T00:00:00Z

Content type: tutorial

Language: en

Sources: [AppSignal](<https://devfeed.tech/sources/appsignal.md>)

Topics: [RSpec](<https://devfeed.tech/topics/rspec.md>), [Ruby on Rails](<https://devfeed.tech/topics/ruby-on-rails.md>), [Ruby](<https://devfeed.tech/topics/ruby.md>), [Test-driven development](<https://devfeed.tech/topics/tdd.md>), [Test automation](<https://devfeed.tech/topics/test-automation.md>)

Tags: [how-to](<https://devfeed.tech/tags/how-to.md>), [rspec](<https://devfeed.tech/tags/rspec.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [ruby-on-rails](<https://devfeed.tech/tags/ruby-on-rails.md>)

## AI overview

This tutorial explains how to install and configure shoulda-matchers 8 with RSpec in a Rails app, troubleshoot an undefined matcher error, and use matchers for validations, Active Record behavior, and controller parameters. It also notes setup requirements for uniqueness matchers and version compatibility.

## Source excerpt

Set up shoulda-matchers 8 with RSpec on Rails 8.1: install and configure the gem, fix the validate_presence_of NoMethodError, and use grouped matcher tables.