Class: Assert::View::LeftrightView

Inherits:
DefaultView show all
Defined in:
lib/assert/view/leftright_view.rb

Overview

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

Instance Attribute Summary

Attributes inherited from Base

#output_io, #runtime_result_callback, #suite

Instance Method Summary collapse

Methods inherited from DefaultView

#loaded_tests_statement, #result_count_statement, #results_breakdown_statement, #run_time_statement, #running_tests_statement, #test_count_statement

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

#left_column_display(leftcol_value) ⇒ Object



85
86
87
88
89
90
91
92
93
94
# File 'lib/assert/view/leftright_view.rb', line 85

def left_column_display(leftcol_value)
  case self.options.left_column_groupby
  when :context
    leftcol_value.to_s.gsub(/Test$/, '')
  when :file
    leftcol_value.to_s.gsub(File.expand_path(".", Dir.pwd), '').gsub(/^\/+test\//, '')
  else
    leftcol_value.to_s
  end
end

#left_column_widthObject



96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/assert/view/leftright_view.rb', line 96

def left_column_width
  @left_col_width ||= case self.options.left_column_groupby
  when :context
    self.suite_contexts.collect{|f| f.to_s.gsub(/Test$/, '')}
  when :file
    self.suite_files.collect{|f| f.to_s.gsub(File.expand_path(".", Dir.pwd), '').gsub(/^\/+test\//, '')}
  else
    []
  end.inject(0) do |max_size, klass|
    klass.to_s.size > max_size ? klass.to_s.size : max_size
  end + 1
end

#leftright_groupsObject



74
75
76
77
78
79
80
81
82
83
# File 'lib/assert/view/leftright_view.rb', line 74

def leftright_groups
  case self.options.left_column_groupby
  when :context
    self.ordered_suite_contexts
  when :file
    self.ordered_suite_files
  else
    []
  end
end

#loaded_suite_statementObject



66
67
68
# File 'lib/assert/view/leftright_view.rb', line 66

def loaded_suite_statement
  "Loaded suite #{$0.to_s}"
end

#right_column_widthObject



109
110
111
# File 'lib/assert/view/leftright_view.rb', line 109

def right_column_width
  self.options.right_column_width
end

#started_statementObject



70
71
72
# File 'lib/assert/view/leftright_view.rb', line 70

def started_statement
  "Started"
end