Michael Yagudaev
1 min readFeb 17, 2019

--

Luckily with Rails, we have Rake and it is easy to write a rake task that clears the data you need. If you want to optimize for performance and avoid startup time of rake, you could expose a special endpoint only under test/development environment something like “POST /debug/reset-db”. Or even mark db save points and rollback (https://www.postgresql.org/docs/8.2/sql-rollback-to.html). Something like “POST /debug/save-point” and “POST /debug/reset-to-save-point”. It is easy to call those endpoints from the before hooks in cypress.

--

--

Michael Yagudaev
Michael Yagudaev

Written by Michael Yagudaev

Founder of nano3labs, obsessed with react, rails, design, technology, art & business. http://nano3labs.com http://yagudaev.com/

No responses yet