Run only newly added specs

Jahangir Anwari
TarkaLabs TIL
Published in
1 min readMay 28, 2019

When working on a major feature it is common to have are a number of new test files associated with it. It can be a pain to manually specify each test file when testing to ensure that all the aspects of the new feature are working correctly. To eliminate the manual labour I use the below commands snippet to run Rspec on all newly added spec files in a feature branch:

$ git log --name-only origin/master..HEAD | awk 'NF && /spec.*rb/ && !/support|factories/' | uniq | xargs bundle exec rspec

--

--