class Setup::Tester

Complexities arise in trying to figure out what test framework is used, and how to run tests. To simplify the process, this class simply looks for a special Ruby script at either ‘.setup/test.rb` or a shell script at `.setup/test.sh` and runs the such script accordingly. The Ruby script has priority if both exist.

Constants

DEPRECATED_RUBYSCRIPT
RUBYSCRIPT
SHELLSCRIPT

Public Instance Methods

test() click to toggle source
# File lib/setup/tester.rb, line 32
def test
  return true unless testable?

  if File.exist?(RUBYSCRIPT)
    test_rubyscript
  elsif File.exist?(SHELLSCRIPT)
    test_shellscript
  else
    true
  end
end
test_rubyscript() click to toggle source
# File lib/setup/tester.rb, line 50
def test_rubyscript
  ruby(RUBYSCRIPT)
end
test_shellscript() click to toggle source
# File lib/setup/tester.rb, line 45
def test_shellscript
  bash(SHELLSCRIPT)
end
testable?() click to toggle source
# File lib/setup/tester.rb, line 20
def testable?
  if File.exist?(DEPRECATED_RUBYSCRIPT)
    warn "Must use `.setup/test.rb' instead or `.setup/testrc.rb' to support testing."
  end

  return false if config.no_test
  return true  if File.exist?(RUBYSCRIPT)
  return true  if File.exist?(SHELLSCRIPT)
  false
end