Skip to content

Instantly share code, notes, and snippets.

@Lockyy
Last active June 15, 2023 09:25
Show Gist options
  • Save Lockyy/e4b1de7b0a4872423e4431bcd7dd957e to your computer and use it in GitHub Desktop.
Save Lockyy/e4b1de7b0a4872423e4431bcd7dd957e to your computer and use it in GitHub Desktop.
Uses files-diff to retrieve a list of changed files and then filters it down to runnable specs then runs them
#!/bin/bash
changedSpecFiles=$(files-diff | grep '^spec' | grep -v 'spec/support' | grep -v 'spec/factories')
joinedSpecFileNames=$($changedSpecFiles | tr "\n" " ")
spring rspec "$@" $($joinedSpecFileNames)
@Lockyy
Copy link
Author

Lockyy commented Jun 15, 2023

I should probably update this so that it just hunts for anything ending in _spec.rb rather than trying to exclude specific folders.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment