class Quails::TestUnitReporter
Constants
- COLOR_BY_RESULT_CODE
Public Instance Methods
filtered_results()
click to toggle source
# File railties/lib/rails/test_unit/reporter.rb, line 45 def filtered_results if options[:verbose] results else results.reject(&:skipped?) end end
record(result)
click to toggle source
Calls superclass method
# File railties/lib/rails/test_unit/reporter.rb, line 10 def record(result) super if options[:verbose] io.puts color_output(format_line(result), by: result) else io.print color_output(result.result_code, by: result) end if output_inline? && result.failure && (!result.skipped? || options[:verbose]) io.puts io.puts io.puts color_output(result, by: result) io.puts io.puts format_rerun_snippet(result) io.puts end if fail_fast? && result.failure && !result.skipped? raise Interrupt end end
relative_path_for(file)
click to toggle source
# File railties/lib/rails/test_unit/reporter.rb, line 53 def relative_path_for(file) file.sub(/^#{app_root}\/?/, "") end
report()
click to toggle source
# File railties/lib/rails/test_unit/reporter.rb, line 33 def report return if output_inline? || filtered_results.empty? io.puts io.puts "Failed tests:" io.puts io.puts aggregated_results end
Private Instance Methods
app_root()
click to toggle source
# File railties/lib/rails/test_unit/reporter.rb, line 75 def app_root @app_root ||= if defined?(ENGINE_ROOT) ENGINE_ROOT elsif Quails.respond_to?(:root) Quails.root end end
color_output(string, by:)
click to toggle source
# File railties/lib/rails/test_unit/reporter.rb, line 96 def color_output(string, by:) if colored_output? "\e[#{COLOR_BY_RESULT_CODE[by.result_code]}m#{string}\e[0m" else string end end
colored_output?()
click to toggle source
# File railties/lib/rails/test_unit/reporter.rb, line 84 def colored_output? options[:color] && io.respond_to?(:tty?) && io.tty? end
fail_fast?()
click to toggle source
# File railties/lib/rails/test_unit/reporter.rb, line 62 def fail_fast? options[:fail_fast] end
format_line(result)
click to toggle source
# File railties/lib/rails/test_unit/reporter.rb, line 66 def format_line(result) "%s#%s = %.2f s = %s" % [result.class, result.name, result.time, result.result_code] end
format_rerun_snippet(result)
click to toggle source
# File railties/lib/rails/test_unit/reporter.rb, line 70 def format_rerun_snippet(result) location, line = result.method(result.name).source_location "#{executable} #{relative_path_for(location)}:#{line}" end
output_inline?()
click to toggle source
# File railties/lib/rails/test_unit/reporter.rb, line 58 def output_inline? options[:output_inline] end