Filtering rails test to run

Is there a way to filter which test I want to run? for example, I don’t want rails to run the test that starts with the letters c, p, or s in a given route

You can achieve that with a regex. For example:

rails test test/controllers/[^c^s^p]*.rb

This command will run all the tests in the test/controllers folder that don’t start with the letters c, p or s. Hope that helps!

2 Likes