class Assertor::Reporter

Attributes

case_list[R]
io[R]

Public Class Methods

new(io=$stdout, case_list=Assertor::Case.all) click to toggle source
# File lib/assertor/reporter.rb, line 7
def initialize(io=$stdout, case_list=Assertor::Case.all)
  @io = io
  @case_list = case_list

  @passed, @failed, @errors, @exceptions = [],[],[],{}
end

Public Instance Methods

run() click to toggle source
# File lib/assertor/reporter.rb, line 14
def run
  calculate_results
  print_counters
  print_tests_with_exceptions(@failed, 'Failed')
  print_tests_with_exceptions(@errors, 'Error')
end

Private Instance Methods

add_case_name_to_tests(test_case, tests) click to toggle source
# File lib/assertor/reporter.rb, line 38
def add_case_name_to_tests(test_case, tests)
  tests.collect{ |test| "#{test_case}.#{test}" }
end
add_test_results(test_case, results) click to toggle source
# File lib/assertor/reporter.rb, line 29
def add_test_results(test_case, results)
  @passed += add_case_name_to_tests(test_case, results[:passed])
  @failed += add_case_name_to_tests(test_case, results[:failed])
  @errors += add_case_name_to_tests(test_case, results[:errors])
  results[:exceptions].each do |test, exception|
    @exceptions["#{test_case}.#{test}"] = exception
  end
end
calculate_results() click to toggle source
# File lib/assertor/reporter.rb, line 23
def calculate_results
  Assertor::Case.run_all(@case_list).each do |test_case, results|
    add_test_results(test_case, results)
  end
end
print_counters() click to toggle source
print_tests_with_exceptions(tests, type) click to toggle source