Things you might not need in your tests
31-Jan-2025 4
No one likes slow and brittle tests, in particular if you’re working a TDD workflow. Often, tests get that way because they’re doing too much. Consider avoiding the following:
Using a database
Database access imposes many costs on your tests. You need to setup a database, connect to it, clean it between test runs, etc. And then each call to the db is slow.
In a typical Rails app, it’s unlikely that you’ll be able to avoid the database entirely, but you can reduce its usage. For instance, let’s consider this model:.
Things you might not need in your tests #ruby #rubydeveloper #rubyonrails #Things #might #tests #tests https://rubyonrails.ba/link/things-you-might-not-need-in-your-tests