rails-antipattern-mock-heavy-tests

Installation
SKILL.md

Antipattern: Mock-Heavy Tests

The smell

  • Tests with more mock / stub / expect(...).to receive(...) lines than assertions
  • Models, mailers, and jobs all stubbed out — no real DB activity
  • Tests that pass while production breaks (mock/reality drift)
  • Refactors break unrelated tests because mocks know too much

Why it hurts

  • Tests describe collaboration mechanics, not behavior
  • New devs can't read the test as a spec for the system
  • Refactors break tests that have nothing to do with the refactor
  • Hides design problems (anemic models, excessive DI)
Installs
2
First Seen
May 8, 2026
rails-antipattern-mock-heavy-tests — gierd-inc/dev-skills