Last week I joined to practise Ruby. I’m looking forward to iterating on the problems set out by @kytrinyx and co. I think the open-ended nature will encourage me to iterate and practise lots of small decisions.

Free tests

Each exercise comes with some instructions and a test file. Yes, free tests! so you can concentrate on writing code to make them pass one by one. I start my getting all the tests passing with the minimum amount of code possible. Then once they’re passing and my head has engaged with the problem, I look for opportunities to refactor.


Like many code practice sites, once you’ve submitted your solution you can see other people’s solutions. This is a great resource for finding alternative ways to write a solution. As part of my practice I try to find at least one or two alternatives I can try out. I’ve discovered several standard library methods already. And I’ve found that being able to submit several iterations of each exercise has encouraged me to.

Short feedback loop

I enjoy TDD with a short feedback loop. I use Guard to run the tests. Since they’re written in MiniTest you’ll need:

gem install guard-minitest

If you use on a Mac, you can get a notification each time Guard runs the tests by installing a handy gem:

gem install terminal-notifier-guard

I put a copy of the following Guardfile in each exercise folder, so that Guard knows to look in the same directory, fire up Sublime Text and run guard.

# A sample Guardfile for Ruby exercises from
# More info at

guard :minitest, test_folders: '.' do
  # with Minitest::Unit
  watch(%r{^(.+)_test\.rb}) { |m| "./#{m[1]}_test.rb" }

With this set up, every time I save the test file Guard runs the tests for me.

See you on!