Class: Assert::View::Base

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

Direct Known Subclasses

DefaultView

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers::Common

#all_pass?, #all_pass_result_summary_msg, #count, #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

Methods included from Options

included

Constructor Details

#initialize(output_io, suite = Assert.suite) ⇒ Base



26
27
28
29
30
31
32
33
# File 'lib/assert/view/base.rb', line 26

def initialize(output_io, suite=Assert.suite)
  @output_io = output_io
  @suite     = suite

  if @output_io.respond_to?(:sync=)
    @output_io.sync = true
  end
end

Instance Attribute Details

#output_io ⇒ Object

Returns the value of attribute output_io.



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

def output_io
  @output_io
end

#suite ⇒ Object

Returns the value of attribute suite.



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

def suite
  @suite
end

Instance Method Details

#after_load ⇒ Object



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

def after_load;        end

#after_test(test) ⇒ Object



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

def after_test(test);  end

#before_load ⇒ 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


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

def before_load;       end

#before_test(test) ⇒ Object



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

def before_test(test); end

#fire(callback, *args) ⇒ Object



37
38
39
# File 'lib/assert/view/base.rb', line 37

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

#on_finish ⇒ Object



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

def on_finish;         end

#on_result(result) ⇒ Object



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

def on_result(result); end

#on_start ⇒ Object



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

def on_start;          end


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

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

#puts(*args) ⇒ Object

IO capture



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

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

#view ⇒ Object



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

def view; self; end