module RunnyTest

Constants

VERSION

Public Instance Methods

run_all_tests() click to toggle source
# File lib/runny_test.rb, line 9
def run_all_tests
  tests  = ARGV[0..ARGV.length]
  @missing_test_files = []

  if tests.nil?
    puts "Usage: runny <test_file1> <test_file2>..."
  else
    tests.each do |test|
      run_test(test)
    end
  end

  unless @missing_test_files.empty?
    puts "Nonexistant files:\n"

    @missing_test_files.each do |f|
      puts "#{f}\n"
    end
  end
end

Private Instance Methods

run_directory_of_tests(dir) click to toggle source
# File lib/runny_test.rb, line 43
def run_directory_of_tests(dir)
  if dir.include? '*'
    Dir.glob(dir) do |f|
      run_test(f)
    end
  else
    Dir.foreach(dir) do |file|
      next if file == '.' || file == '..'
      run_test("#{dir}#{file}")
    end
  end
end
run_test(test) click to toggle source
# File lib/runny_test.rb, line 31
def run_test(test)
  if File.directory? test
    run_directory_of_tests(test)
  elsif File.exists? test
    puts `echo RUNNING TEST: #{test}`
    a = puts `ruby -Itest #{test}`
    puts "\n"
  else
    @missing_test_files << test
  end
end