Why this matters
Isolation and behavior-focused assertions reduce flakiness.
Use WebMock or equivalent to stub external requests in specs and prefer effect-based matchers (e.g., change(Model, :count)) over brittle value guesses.
Isolation and behavior-focused assertions reduce flakiness.
Side-by-side examples engineers can pattern-match during review.
it 'creates user' do\n create_user\n expect(User.count).to eq(User.count + 1) # nonsense\nendit 'creates user' do\n stub_request(:post, 'https://api.example.com/users').to_return(status:201)\n expect{ create_user }.to change(User, :count).by(1)\nendexpect{ op }.to change(Model, :count).by(1)Net::HTTP.get(URI('https://real.example'))From the same buckets as this rule.
Reject PRs adding real PAN/CVV in fixtures, seeds, or mocks. Only use Luhn-valid test PANs from the gateway or opaque tokens (e.g., tok_) and never include CVV. Add a check to fail if a PAN regex is matched. (PCI DSS data minimization)