Class: Assert::View::Base

Inherits:
Object
  • Object
show all
Includes:
Helpers::Common
Defined in:
lib/assert/view/base.rb

Direct Known Subclasses

DefaultView

Instance Method Summary collapse

Methods included from Helpers::Common

#all_pass?, #all_pass_result_summary_msg, #captured_output, #count, included, #matched_result_details_for, #ocurring_result_types, #ordered_suite_contexts, #ordered_suite_files, #result_count_statement, #result_details_for, #result_summary_msg, #results_summary_sentence, #run_time, #runner_seed, #show_result_details?, #suite_contexts, #suite_files, #test_count_statement, #tests?, #to_sentence

Constructor Details

#initialize(output_io, suite = nil) ⇒ Base

Returns a new instance of Base.



20
21
22
23
# File 'lib/assert/view/base.rb', line 20

def initialize(output_io, suite=nil)
  @output_io, @suite = output_io, suite
  @output_io.sync = true if @output_io.respond_to?(:sync=)
end

Instance Method Details

#after_loadObject



52
# File 'lib/assert/view/base.rb', line 52

def after_load;        end

#after_test(test) ⇒ Object



56
# File 'lib/assert/view/base.rb', line 56

def after_test(test);  end

#before_loadObject

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



51
# File 'lib/assert/view/base.rb', line 51

def before_load;       end

#before_test(test) ⇒ Object



54
# File 'lib/assert/view/base.rb', line 54

def before_test(test); end

#fire(callback, *args) ⇒ Object



28
29
30
# File 'lib/assert/view/base.rb', line 28

def fire(callback, *args)
  self.send(callback, *args)
end

#on_finishObject



57
# File 'lib/assert/view/base.rb', line 57

def on_finish;         end

#on_result(result) ⇒ Object



55
# File 'lib/assert/view/base.rb', line 55

def on_result(result); end

#on_startObject



53
# File 'lib/assert/view/base.rb', line 53

def on_start;          end


62
# File 'lib/assert/view/base.rb', line 62

def print(*args); @output_io.print(*args); end

#puts(*args) ⇒ Object

IO capture



61
# File 'lib/assert/view/base.rb', line 61

def puts(*args); @output_io.puts(*args); end

#suiteObject



26
# File 'lib/assert/view/base.rb', line 26

def suite; @suite || Assert.suite; end

#viewObject



25
# File 'lib/assert/view/base.rb', line 25

def view; self; end