# thoughtbot/shoulda-matchers

Simple one-liner tests for common Rails functionality

Repository: https://github.com/thoughtbot/shoulda-matchers
Canonical: https://ross.abutalabs.com/products/shoulda-matchers
Homepage: https://matchers.shoulda.io
Language: Ruby
License: MIT
License Family: permissive
Topics: ruby, rspec, rails, testing
Last push: 2026-08-10T13:14:13+00:00

## Health v2 (maintenance only)
Score: 86/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 97, release rhythm 64, longevity 100
- inputs: {"age_days": 5740, "days_push": 23, "days_rel": 82, "gap_med": 94.0, "n_releases_24m": 5}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 3582, forks 917 (observed 2026-08-28T04:08:11.002054+00:00)

## What it is
A Ruby gem providing RSpec- and Minitest-compatible one-liner matchers for testing common Rails functionality like validations, associations, and controller behavior. It offers 30+ pre-built matchers for ActiveModel, ActiveRecord, ActionController, and routing.

## Use cases
- test rails model validations with one-liners
- test activerecord associations in rspec
- write shorter rails unit tests
- test uniqueness validation scoped to a column
- test controller and routing behavior in rails
- add shoulda matchers to minitest suite

## When to choose
- you maintain a Rails app with RSpec or Minitest tests
- you want concise, readable tests for validations, associations, and controllers
- you want to reduce boilerplate in your test suite

## When to avoid
- you don't use Rails or ActiveModel/ActiveRecord
- you prefer writing explicit, hand-rolled test assertions
- you use a test framework other than RSpec or Minitest

## Facets
- artifact type: library
- maturity: stable
- function: testing, e2e-testing
- domain: testing, web-development, developer-tools
- platform: ruby
- tags: rspec, minitest, one-liner-tests, active-record, active-model, action-controller, rails

## Member repositories
- thoughtbot/shoulda-matchers (main) score 86

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:08:11.002054+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T18:33:57.878013+00:00, confidence not recorded.
  - readme: https://github.com/thoughtbot/shoulda-matchers (fetched 2026-08-28T04:08:11.002054+00:00, sha c9356ccc9b17)
  - homepage: https://matchers.shoulda.io (fetched 2026-08-29T09:27:25.308721+00:00, sha 3e731a5c4316)
  - site_page: https://matchers.shoulda.io/docs (fetched 2026-08-29T09:27:25.317706+00:00, sha ca8433d39e54)
- Data as of 2026-08-30T08:39:29.467469+00:00.
