Class: Assert::DefaultView
Overview
This is the default view used by assert. It renders ansi test output designed for terminal viewing.
Defined Under Namespace
Classes: ResultData, TestData
Constant Summary
ViewHelpers::Ansi::CODES
Instance Attribute Summary
Attributes inherited from View
#config
Instance Method Summary
collapse
#ansi_styled_msg, code_for
Methods inherited from View
#after_test, #before_test, #initialize, #is_tty?, #on_result, #print, #puts, require_user_view, #view
included
#all_pass?, #error_result_count, #fail_result_count, #formatted_result_rate, #formatted_run_time, #formatted_suite_result_rate, #formatted_suite_run_time, #formatted_suite_test_rate, #formatted_test_rate, #ignore_result_count, #ocurring_result_types, #pass_result_count, #result_count, #runner, #runner_seed, #show_test_profile_info?, #show_test_verbose_info?, #single_test?, #single_test_file_line, #skip_result_count, #suite, #test_count, #tests_to_run?, #tests_to_run_count, #view
Constructor Details
This class inherits a constructor from Assert::View
Instance Method Details
#after_load ⇒ Object
22
23
24
|
# File 'lib/assert/default_view.rb', line 22
def after_load
puts "Loaded suite (#{tests_to_run_count_statement})"
end
|
#before_load(test_files) ⇒ Object
19
20
|
# File 'lib/assert/default_view.rb', line 19
def before_load(test_files)
end
|
#on_finish ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'lib/assert/default_view.rb', line 31
def on_finish
if self.test_count > 0
dump_test_results
end
if show_test_profile_info?
@test_datas.values.sort{ |a, b| a.run_time <=> b.run_time }.each do |test_data|
puts "#{formatted_run_time(test_data.run_time)} seconds,"\
" #{test_data.result_count} results,"\
" #{formatted_result_rate(test_data.result_rate)} results/s --"\
" #{test_data.context}: #{test_data.name.inspect}"
end
puts
end
styled_results_sentence = results_summary_sentence do |summary, result_type|
ansi_styled_msg(summary, result_type)
end
puts "#{result_count_statement}: #{styled_results_sentence}"
puts
puts "(#{formatted_suite_run_time} seconds, " \
"#{formatted_suite_test_rate} tests/s, " \
"#{formatted_suite_result_rate} results/s)"
end
|
#on_info(test) ⇒ Object
60
61
62
63
64
65
66
67
|
# File 'lib/assert/default_view.rb', line 60
def on_info(test)
dump_test_results
puts "Current test:"
puts test.name
puts test.file_line.to_s
puts
end
|
#on_interrupt(err) ⇒ Object
69
70
71
|
# File 'lib/assert/default_view.rb', line 69
def on_interrupt(err)
dump_test_results
end
|
#on_start ⇒ Object
26
27
28
29
|
# File 'lib/assert/default_view.rb', line 26
def on_start
reset_run_data
set_callbacks
end
|