Ylan Segal

Run Changed Specs

I usually create a branch while working on a feature or bug. I found it helpful to add the following script to my path:

#! /bin/bash

git diff --name-only master..HEAD | grep 'spec.rb' | xargs rspec

It’s quick and dirty, but effective. It asks git for a list of filenames that have changed in the current branch, filters them to find specs and runs them with rspec.