« Tighten it up (your feedback loop).

April 7, 2016 • ☕️ 1 min read

I don’t know about you but if I am running tests between changes in my code, and the they start taking more than 5–10 seconds to run I start to get distracted. Twitter, Reddit, memes.

In order to stay focused I have implemented a little trick for myself. I use Rspec and Guard, but I am sure there are solutions similar for other testing stacks.

when I save a file Guard automatically runs the test in that file or if I save the corresponding ruby file I am testing it will do the same.

IE if I save `my_sweet_program.rb` guard will run `my_sweet_program_spec.rb`. This is great until the file has 100 tests and takes 1 minute to run(I am not condoning these types of test suites…). Did you hear about those opinions on the internet? didn’t the rouge one trailer come out today? what I was testing anyway?

Oh yeah! I am talking about feedback loops and how they keep us focused.

So in order to solve this I have added a filter and a rule about the filters in my rspec config file so it now looks like this:

now when I add `focus: true` as an argument in my context or it blocks it will only run the tests within those blocks. and the second config option, (if you didn’t guess by now) will make all the tests in that file run if there are no blocks with focus set to true.

That is all.

I am trying to write more and part of that means taking on smaller topics/things to write about,