Class: Assert::View
- Inherits:
-
Object
- Object
- Assert::View
- Includes:
- ConfigHelpers, ViewHelpers
- Defined in:
- lib/assert/view.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Class Method Summary collapse
-
.require_user_view(view_name) ⇒ Object
this method is used to bring in custom user-specific views require views by passing either a full path to the view ruby file or passing the name of a view installed in ~/.assert/views.
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_info`: called when the INFO signal is triggered whil runninng the test suite * `on_interrupt`: called when the test suite is interrupted while running the interrupt exception is passed as an arg.
- #before_test(test) ⇒ Object
-
#initialize(config, output_io) ⇒ View
constructor
A new instance of View.
- #is_tty? ⇒ Boolean
- #on_finish ⇒ Object
- #on_info(test) ⇒ 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 ViewHelpers
Methods included from ConfigHelpers
#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
Constructor Details
#initialize(config, output_io) ⇒ View
Returns a new instance of View.
48 49 50 51 |
# File 'lib/assert/view.rb', line 48 def initialize(config, output_io) @config , @output_io, = config, output_io @output_io.sync = true if @output_io.respond_to?(:sync=) end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
46 47 48 |
# File 'lib/assert/view.rb', line 46 def config @config end |
Class Method Details
.require_user_view(view_name) ⇒ Object
this method is used to bring in custom user-specific views require views by passing either a full path to the view ruby file or passing the name of a view installed in ~/.assert/views
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/assert/view.rb', line 15 def self.require_user_view(view_name) views_file = File.( File.join("#{ENV["HOME"]}/.assert/views", view_name, "lib", view_name) ) if File.exists?(view_name) || File.exists?(view_name + ".rb") require view_name elsif File.exists?(views_file + ".rb") require views_file else msg = "[WARN] Can't find or require #{view_name.inspect} view." msg << " Did you install it in `~/.assert/views`?" if !view_name.match(/\A\//) warn msg end end |
Instance Method Details
#after_load ⇒ Object
81 |
# File 'lib/assert/view.rb', line 81 def after_load; end |
#after_test(test) ⇒ Object
85 |
# File 'lib/assert/view.rb', line 85 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_info`: called when the INFO signal is triggered whil runninng
the test suite
-
‘on_interrupt`: called when the test suite is interrupted while running
the interrupt exception is passed as an arg
80 |
# File 'lib/assert/view.rb', line 80 def before_load(test_files); end |
#before_test(test) ⇒ Object
83 |
# File 'lib/assert/view.rb', line 83 def before_test(test); end |
#is_tty? ⇒ Boolean
55 56 57 |
# File 'lib/assert/view.rb', line 55 def is_tty? !!@output_io.isatty end |
#on_finish ⇒ Object
86 |
# File 'lib/assert/view.rb', line 86 def on_finish; end |
#on_info(test) ⇒ Object
87 |
# File 'lib/assert/view.rb', line 87 def on_info(test); end |
#on_interrupt(err) ⇒ Object
88 |
# File 'lib/assert/view.rb', line 88 def on_interrupt(err); end |
#on_result(result) ⇒ Object
84 |
# File 'lib/assert/view.rb', line 84 def on_result(result); end |
#on_start ⇒ Object
82 |
# File 'lib/assert/view.rb', line 82 def on_start; end |
#print(*args) ⇒ Object
93 |
# File 'lib/assert/view.rb', line 93 def print(*args); @output_io.print(*args); end |
#puts(*args) ⇒ Object
IO capture
92 |
# File 'lib/assert/view.rb', line 92 def puts(*args); @output_io.puts(*args); end |
#view ⇒ Object
53 |
# File 'lib/assert/view.rb', line 53 def view; self; end |