Class: Rails::TestUnitReporter
- Inherits:
-
Minitest::StatisticsReporter
- Object
- Minitest::StatisticsReporter
- Rails::TestUnitReporter
- Defined in:
- railties/lib/rails/test_unit/reporter.rb
Instance Attribute Summary collapse
-
#app_root ⇒ Object
writeonly
Sets the attribute app_root.
-
#executable ⇒ Object
Returns the value of attribute executable.
Instance Method Summary collapse
-
#aggregated_results ⇒ Object
:nodoc:.
- #filtered_results ⇒ Object
- #prerecord(test_class, test_name) ⇒ Object
- #record(result) ⇒ Object
- #relative_path_for(file) ⇒ Object
- #report ⇒ Object
Instance Attribute Details
#app_root=(value) ⇒ Object
Sets the attribute app_root
7 8 9 |
# File 'railties/lib/rails/test_unit/reporter.rb', line 7 def app_root=(value) @app_root = value end |
#executable ⇒ Object
Returns the value of attribute executable.
10 11 12 |
# File 'railties/lib/rails/test_unit/reporter.rb', line 10 def executable @executable end |
Instance Method Details
#aggregated_results ⇒ Object
:nodoc:
50 51 52 |
# File 'railties/lib/rails/test_unit/reporter.rb', line 50 def aggregated_results # :nodoc: filtered_results.map { |result| format_rerun_snippet(result) }.join "\n" end |
#filtered_results ⇒ Object
54 55 56 57 58 59 60 |
# File 'railties/lib/rails/test_unit/reporter.rb', line 54 def filtered_results if [:verbose] results else results.reject(&:skipped?) end end |
#prerecord(test_class, test_name) ⇒ Object
12 13 14 15 16 17 |
# File 'railties/lib/rails/test_unit/reporter.rb', line 12 def prerecord(test_class, test_name) super if [:verbose] io.print "%s#%s = " % [test_class.name, test_name] end end |
#record(result) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'railties/lib/rails/test_unit/reporter.rb', line 19 def record(result) super if [: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? || [: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) ⇒ Object
62 63 64 65 66 67 68 |
# File 'railties/lib/rails/test_unit/reporter.rb', line 62 def relative_path_for(file) if app_root file.sub(/^#{app_root}\/?/, "") else file end end |
#report ⇒ Object
42 43 44 45 46 47 48 |
# File 'railties/lib/rails/test_unit/reporter.rb', line 42 def report return if output_inline? || filtered_results.empty? io.puts io.puts "Failed tests:" io.puts io.puts aggregated_results end |