Class: Assert::View::Base
- Inherits:
-
Object
- Object
- Assert::View::Base
- Includes:
- Helpers::Common
- Defined in:
- lib/assert/view/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#suite ⇒ Object
readonly
Returns the value of attribute suite.
Instance Method Summary collapse
- #after_load ⇒ Object
- #after_test(test) ⇒ Object
-
#before_load(test_files) ⇒ Object
available callbacks from the runner: * ‘before_load`: called at the beginning, before the suite is loaded * `after_load`: called after the suite is loaded, just before `on_start` functionally equivalent to `on_start` * `on_start`: called when a loaded test suite starts running * `before_test`: called before a test starts running the test is passed as an arg * `on_result`: called when a running tests generates a result the result is passed as an arg * `after_test`: called after a test finishes running the test is passed as an arg * `on_finish`: called when the test suite is finished running * `on_interrupt`: called when the test suite is interrupted while running the interrupt exception is passed as an arg.
- #before_test(test) ⇒ Object
- #fire(callback, *args) ⇒ Object
-
#initialize(output_io, *args) ⇒ Base
constructor
A new instance of Base.
- #is_tty? ⇒ Boolean
- #on_finish ⇒ Object
- #on_interrupt(err) ⇒ Object
- #on_result(result) ⇒ Object
- #on_start ⇒ Object
- #print(*args) ⇒ Object
-
#puts(*args) ⇒ Object
IO capture.
- #view ⇒ Object
Methods included from Helpers::Common
#all_pass?, #all_pass_result_summary_msg, #captured_output, #count, included, #matched_result_details_for, #ocurring_result_types, #ordered_profile_tests, #ordered_suite_contexts, #ordered_suite_files, #result_count_statement, #result_details_for, #result_rate, #result_summary_msg, #results_summary_sentence, #run_time, #runner_seed, #show_result_details?, #show_test_profile_info?, #show_test_verbose_info?, #suite_contexts, #suite_files, #test_count_statement, #test_rate, #test_result_rate, #test_run_time, #tests?, #to_sentence
Constructor Details
#initialize(output_io, *args) ⇒ Base
Returns a new instance of Base.
24 25 26 27 28 29 30 31 32 |
# File 'lib/assert/view/base.rb', line 24 def initialize(output_io, *args) @output_io = output_io @suite, @config = [ args.last.kind_of?(Assert::Suite) ? args.pop : nil, args.last.kind_of?(Assert::Config) ? args.pop : nil ] @output_io.sync = true if @output_io.respond_to?(:sync=) end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
22 23 24 |
# File 'lib/assert/view/base.rb', line 22 def config @config end |
#suite ⇒ Object (readonly)
Returns the value of attribute suite.
22 23 24 |
# File 'lib/assert/view/base.rb', line 22 def suite @suite end |
Instance Method Details
#after_load ⇒ Object
76 |
# File 'lib/assert/view/base.rb', line 76 def after_load; end |
#after_test(test) ⇒ Object
80 |
# File 'lib/assert/view/base.rb', line 80 def after_test(test); end |
#before_load(test_files) ⇒ Object
available callbacks from the runner:
-
‘before_load`: called at the beginning, before the suite is loaded
-
‘after_load`: called after the suite is loaded, just before `on_start`
functionally equivalent to `on_start`
-
‘on_start`: called when a loaded test suite starts running
-
‘before_test`: called before a test starts running
the test is passed as an arg
-
‘on_result`: called when a running tests generates a result
the result is passed as an arg
-
‘after_test`: called after a test finishes running
the test is passed as an arg
-
‘on_finish`: called when the test suite is finished running
-
‘on_interrupt`: called when the test suite is interrupted while running
the interrupt exception is passed as an arg
75 |
# File 'lib/assert/view/base.rb', line 75 def before_load(test_files); end |
#before_test(test) ⇒ Object
78 |
# File 'lib/assert/view/base.rb', line 78 def before_test(test); end |
#fire(callback, *args) ⇒ Object
50 51 52 |
# File 'lib/assert/view/base.rb', line 50 def fire(callback, *args) self.send(callback, *args) end |
#is_tty? ⇒ Boolean
34 35 36 |
# File 'lib/assert/view/base.rb', line 34 def is_tty? !!@output_io.isatty end |
#on_finish ⇒ Object
81 |
# File 'lib/assert/view/base.rb', line 81 def on_finish; end |
#on_interrupt(err) ⇒ Object
82 |
# File 'lib/assert/view/base.rb', line 82 def on_interrupt(err); end |
#on_result(result) ⇒ Object
79 |
# File 'lib/assert/view/base.rb', line 79 def on_result(result); end |
#on_start ⇒ Object
77 |
# File 'lib/assert/view/base.rb', line 77 def on_start; end |
#print(*args) ⇒ Object
87 |
# File 'lib/assert/view/base.rb', line 87 def print(*args); @output_io.print(*args); end |
#puts(*args) ⇒ Object
IO capture
86 |
# File 'lib/assert/view/base.rb', line 86 def puts(*args); @output_io.puts(*args); end |
#view ⇒ Object
38 39 40 |
# File 'lib/assert/view/base.rb', line 38 def view self end |