use rspec-rerun instead of custom function