Skip to content

Instantly share code, notes, and snippets.

@vagnerzampieri
Created September 4, 2015 21:36
Show Gist options
  • Select an option

  • Save vagnerzampieri/5b63af5a4d1e81195122 to your computer and use it in GitHub Desktop.

Select an option

Save vagnerzampieri/5b63af5a4d1e81195122 to your computer and use it in GitHub Desktop.
Pegar todos os arquivos que foram modificados no git, olhar dentro deles por paths do VCR, encontrar os paths reais, deletar e depois rodar as specs
#!/bin/bash
vcr='(VCR)'
all_bettewen_quotes='(\".+\")'
declare -a files
count=0
# Read file and get all cassettes from VCR
while read line; do
if [[ $line =~ $vcr ]]; then
[[ $line =~ $all_bettewen_quotes ]]
files[$count]=$BASH_REMATCH
(( count++ ))
fi
done < "$1"
echo ${files[@]}
# delete all files
for f in ${files[@]}; do
echo $f
echo `find spec/fixtures/ | grep ${f}`
# for i in `find spec/fixtures/ | grep $f`; do
# echo $i
# `rm $i`
# done
done
# pega tudo que estiver entre parênteses
# \".+\"
#
# VCR.use_cassette("commands/integrations/emites_nfse/cancel/success") do
# VCR.use_cassette("commands/integrations/emites_nfse/cancel/already_cancelled") do
#
#find spec/fixtures/ | grep "commands/integrations/emites_nfse/cancel/success"
#./all_spec.sh spec/commands/integrations/emites_nfse/cancel_spec.rb
# rspec `git ls-files --modified --others spec`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment