class Attestify::TestRunner

A basic test runner to run all tests.

Attributes

reporter[R]
test_list[R]

Public Class Methods

new(test_list, reporter) click to toggle source
# File lib/attestify/test_runner.rb, line 8
def initialize(test_list, reporter)
  @test_list = test_list
  @reporter = reporter
end

Public Instance Methods

run() click to toggle source
# File lib/attestify/test_runner.rb, line 13
def run
  require_helper
  require_tests
  run_tests
end

Private Instance Methods

report_tests() click to toggle source
# File lib/attestify/test_runner.rb, line 42
def report_tests
  reporter.report
end
require_helper() click to toggle source
# File lib/attestify/test_runner.rb, line 21
def require_helper
  require_real_file test_list.test_helper_file
end
require_real_file(file) click to toggle source

If we don't require via realpath, some relative paths will be rejected as not being in Ruby's path.

# File lib/attestify/test_runner.rb, line 31
def require_real_file(file)
  return unless file
  require File.realpath(file)
end
require_tests() click to toggle source
# File lib/attestify/test_runner.rb, line 25
def require_tests
  test_list.test_files.each { |f| require_real_file f }
end
run_tests() click to toggle source
# File lib/attestify/test_runner.rb, line 36
def run_tests
  Attestify::Test.tests.each do |test|
    test.run(reporter, test_list)
  end
end