Got your feedback loop between writing code and executing tests down to the shortest time possible? Of course you have. After all, you know your tried-and-tested shortcut keys.
But there may be something better than your years-old habit.
Just run Guard
Guard will watch your code for changes. When it detects one, it'll fire up your tests for you in the background. Sounds pretty useful, right?
With Guard on its own, you'd still have to
Tab to your terminal to see the test results.
The advantage to using a desktop notification, as opposed to having your terminal window, is that you can keep your editor at fullscreen. Even better, you can be looking at something else entirely but still see when your tests have finished. This is great for when your tests take a non-trivial amount of time.
It's as simple as adding this to your Gemfile:
group :development do
In our case above, we've added the minitest-reporters and guard-minitest gems.
Then follow the README for Guard on how to initialise and install Guard.
Small savings add up
It might seem very tiny, but the amount of thinking required to remember your key combos and execute them through your keyboard is actually valuable brain power you could be applying to writing code instead. And if you are frequently running tests, these savings add to up to an even greater amount.
I've also started using the guard-livereload gem recently. Using this with the LiveReload browser plugin, any changes made to a view will refresh my browser automatically and show me the changes immediately. Super useful.