Skip to content

Instantly share code, notes, and snippets.

@cvonkleist
Created July 21, 2010 17:14
Show Gist options
  • Save cvonkleist/484784 to your computer and use it in GitHub Desktop.
Save cvonkleist/484784 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# can be called like this:
#
# spec_run.rb foo.rb
# spec_run.rb foo_spec.rb
# spec_run.rb foo.rb -e "some test case"
ruby_file = "" + ARGV.shift
ruby_file.gsub! '.rb', ''
ruby_file.gsub! '_spec', ''
args = ARGV.collect do |arg|
if arg.include?(' ')
'"%s"' % arg
else
arg
end
end
system "spec -c #{args * ' '} #{ruby_file}_spec.rb"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment