Skip to content

Instantly share code, notes, and snippets.

# list all changed spec files
alias d_specs='git diff --name-only | grep _spec.rb|sed -E "s/(.*)/\.\/\1/"'
# list all changed *.rb filenames without path and extension
alias diffrb='git diff --name-only|xargs basename -s .rb'
# diffrb.map { |s| "#{s}_spec"}.join('|')
alias any_diffrb="diffrb | tr '\n' '|'|sed -E \"s/^(.*).$/\1_spec/\""
# list all spec files that correspond to changed *.rb files (assuming they share the same prefix)
alias d_specs_more='find ./spec -name *_spec.rb|grep -E "(`any_diffrb`)"'
# find a spec by path-less name
function find_spec() {