Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 26th, 2012  |  syntax: None  |  size: 0.42 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/usr/bin/env ruby
  2.  
  3. file = ARGV[0]
  4. `cd #{ENV['PWD']}`
  5. if file =~ /_test\.rb/
  6.   output = `cd #{ENV['PWD']} && ruby -Itest #{ARGV[0]}`
  7. else
  8.   file = File.basename(file).gsub(/.rb/, '')
  9.   match = Dir["#{ENV['PWD']}/test/**/*.rb"].each do |f|
  10.     m = File.basename(f)
  11.     if m == "#{file}_test.rb"
  12.       output = `cd #{ENV['PWD']} && ruby -Itest #{f}`
  13.     end
  14.   end
  15. end
  16.  
  17.  
  18. puts output.gsub(/\[42;37;1m|\[0m|\[33;1;40mE|\[33;1;40m/, '')