Write Faster Ruby Tests with FactoryBot#build_stubbed

I paired with a co-worker the other day and explained how we can use FactoryBots build stubbed method paired with rspecs Allow(Model).to receive(:method) to make faster tests.

I think this can apply to more any application tests that hit the database. Creating database objects is slow and over time can make your test suite come to a crawl.

2 Likes