Email verification tests often fail for a reason that is not really email: two test runs are using the same inbox. One run deletes a message that the other run still needs, or a retry reads a verification code that belongs to an earlier attempt.
I prefer treating a test inbox as leased data. A test claims one fixture for a limited period, refreshes that lease while it is active, and releases it when the test finishes. PostgreSQL is a good place for this small coordination problem because the claim and the state transition can happen in one transaction.
The same idea works when a test uses a temp mail.so address or a facebook temp email flow. The provider is not the important part. Ownership and expiry are.
Why email fixtures need a lease
A simple email_fixtures table with an available boolean looks fine at first.…