Guard is a tool to autorun tests as and when they are created. It basically runs a background process that continuously checks for the tests. As soon as they are created, it runs and provides the results. I feel it is an essential thing to increase the pace of work with the tests.
We will start by adding guard and guard-minitest to the Gemfile. Make sure you also add “ruby-prof” to testing group in order to install the dependencies correctly.
Once, the installation is done, we need to generate a configuration file called Guardfile, for minitest.
We can also uncomment the Rails 4 test watch rules. So, guard will now watch minitest unit and Rails 4 unit tests. In case you want to autorun minitest specs, you can also uncomment that part.
We will try and run our guard now. Make sure you run the command using bundle exec guard else guard will throw a warning. This is to inform guard that we are using bundler to manage our gems.