ほぼ find | grep $@ | xargs rspec
してるだけ。簡単だけど便利。
#!/bin/sh
specs=$(find spec -type f -name "*_spec.rb" | grep $@)
if [ $? -ne 0 ]
then
echo "spec not found"
exit 1
fi
echo $specs
rspec $specs
fspec
という名前でバスの通ったとこに置いてる。
$ fspec user
spec/controllers/users_controller_spec.rb spec/models/user_spec.rb spec/routing/user_routing_spec.rb spec/views/users/edit.html.haml_spec.rb spec/views1/users/index.html.haml_spec.rb spec/views1/users/new.html.haml_spec.rb spec/views1/users/show.html.haml_spec.rb
.....
引数はそのまま grep に渡るので -E
つければ拡張正規表現も使える。