Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
i=0
files=()
# sort spec files by number of examples for better balancing
for file in $(find ./spec -name "*_spec.rb" -print0 | xargs -0 grep -e "^ *(it|specify)" -c | sort -t: -k2,2rn | awk -F":" '{ print $1 }')
do
if [ $(($i % $CIRCLE_NODE_TOTAL)) -eq $CIRCLE_NODE_INDEX ]
then
files+=" $file"
fi
((i++))
done
echo "specs to be tested: ${files[@]}"
bundle exec rspec --color --profile -- ${files[@]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment