ruby
Installation
SKILL.md
Ruby / Rails Skill
EasyPost Monolith: Mock Adapter Pattern
CRITICAL: Prefer mock adapter pattern over message mocking for microservice interactions.
The EasyPost monolith uses a mock adapter pattern instead of RSpec message mocking (allow(...).to receive(...)) for testing interactions with microservices like rUSERS and rUSPS.
Key Components
- Mock Adapter Class: In-memory implementation matching live service interface (e.g.,
SupportUsersMockAdapter) - RSpec Metadata: Tests opt-in with
:mock_usersor:mock_uspsmetadata - Factory Integration: Factories automatically populate mock adapter data
- Environment Control:
MOCK_USERS=1(default) for fast tests,MOCK_USERS=0for integration tests