Created
September 14, 2011 19:00
-
-
Save nicklewis/1217449 to your computer and use it in GitHub Desktop.
Run specs in random order
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
if size_opt = ARGV.index('-s') | |
seed = ARGV[size_opt+1] | |
end | |
seed ||= Time.now.to_i | |
if clip_opt = ARGV.index('-c') | |
begin | |
require 'rubygems' | |
require 'clipboard' | |
Clipboard.copy(seed) | |
rescue LoadError => e | |
warn "Could not load 'clipboard' gem which is necessary for '-c'" | |
end | |
end | |
puts "Using seed #{seed}" | |
srand(seed) | |
files = Dir['spec/**/*_spec.rb'].sort_by {rand} | |
system 'rspec', *files | |
exit $? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use -s to specify a particular seed value, and -c to automatically copy the seed of the following run to the clipboard.