Setting up Terminal Notifier (for desktop notifications) with Guard and RSpec
Why should I care about Guard and desktop notifications in the first place ?
One thing that I've been learning through my past experiences is problem solving has got a meaningful connection with discipline in the way we go about our approach to solve a particular problem.
Let's assume you've written some code and have some tests to back up that code. Let's say a new requirement comes in and you have to modify your existing code. Imagine you'd want your code to work for the existing scenario(which is already covered by the existing test case(s)) and for the new requirement.
There are instances when programmers go so deep into solving for the new requirement(this happens more often when you're in some time crunch mode or something on those lines like for instance a pair programming time boxed interview), they may not end up constantly checking how the new modifications in the code has affected their existing tests(which were all green before the changes for the new requirements were introduced) and this way they lose track on which
exact new change in the code made the existing tests to fail.
This is where getting constantly notified about each change can be helpful through a combination of tools like guard and terminal-notifier
The Fix
In order to setup Terminal notifier to give you something like desktop notifications with regard to your test results(for changes you make to your code or to your tests) you need to both terminal-notifier and terminal-notifier-guard gems like you can see in the below case with regard to the development group of a Gemfile.
group :development do
gem 'guard'
gem 'guard-rspec'
gem 'terminal-notifier-guard', '~> 1.6.1'
gem 'terminal-notifier'
end
Currently as per the Guard notifications Wiki for Terminal notifier it only specifies that one needs the terminal-notifier-guard gem to get things up and running, and since it took me sometime to figure out the missing piece, I thought it's worth sharing.
Thanks!
P.S. If you find the post handy feel free to +1 the post and/or share your experiences on anything related through a comment below.