Class: Assert::View::DefaultView

Inherits:
Base
  • Object
show all
Defined in:
lib/assert/view/default_view.rb

Overview

This is the default view used by assert. It renders ansi test output designed for terminal viewing.

Direct Known Subclasses

LeftrightView

Instance Attribute Summary

Attributes inherited from Base

#output_io, #runtime_result_callback, #suite

Instance Method Summary collapse

Methods inherited from Base

#all_pass?, #all_pass_result_summary_msg, #all_results_for, #capture_output_end_msg, #capture_output_start_msg, #count, #detailed_results, #handle_runtime_result, #initialize, #ocurring_result_types, #ordered_suite_contexts, #ordered_suite_files, #result_summary_msg, #run_tests, #run_time, #runner_seed, #show_result_details?, #suite_contexts, #suite_files, template, #tests?, #to_sentence, #view

Methods included from Renderer

included, #render

Constructor Details

This class inherits a constructor from Assert::View::Base

Instance Method Details

#loaded_tests_statementObject



53
54
55
# File 'lib/assert/view/default_view.rb', line 53

def loaded_tests_statement
  "Loaded suite (#{self.test_count_statement})"
end

#result_count_statementObject



73
74
75
# File 'lib/assert/view/default_view.rb', line 73

def result_count_statement
  "#{self.count(:results)} result#{'s' if self.count(:results) != 1}"
end

#results_breakdown_statementObject

generate a sentence fragment describing the breakdown of test results if a block is given, yield each msg in the breakdown for custom template formatting



67
68
69
70
71
# File 'lib/assert/view/default_view.rb', line 67

def results_breakdown_statement
  self.to_sentence(self.ocurring_result_types.collect do |result_sym|
    yield(self.result_summary_msg(result_sym), result_sym) if block_given?
  end)
end

#run_time_statementObject



77
78
79
# File 'lib/assert/view/default_view.rb', line 77

def run_time_statement
  "(#{self.run_time} seconds)"
end

#running_tests_statementObject



61
62
63
# File 'lib/assert/view/default_view.rb', line 61

def running_tests_statement
  "Running tests in random order, seeded with \"#{self.runner_seed}\""
end

#test_count_statementObject



57
58
59
# File 'lib/assert/view/default_view.rb', line 57

def test_count_statement
  "#{self.count(:tests)} test#{'s' if self.count(:tests) != 1}"
end