Class: Minitest::Bender
- Inherits:
-
AbstractReporter
- Object
- AbstractReporter
- Minitest::Bender
- Defined in:
- lib/minitest/bender.rb
Direct Known Subclasses
Constant Summary collapse
- Colorizer =
MinitestBender::Colorizer
Instance Attribute Summary collapse
-
#io ⇒ Object
Returns the value of attribute io.
-
#options ⇒ Object
Returns the value of attribute options.
-
#previous_context ⇒ Object
readonly
Returns the value of attribute previous_context.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
-
#results_by_context ⇒ Object
readonly
Returns the value of attribute results_by_context.
-
#started_at ⇒ Object
readonly
Returns the value of attribute started_at.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(io, options = {}) ⇒ Bender
constructor
A new instance of Bender.
- #passed? ⇒ Boolean
- #record(minitest_result) ⇒ Object
- #report ⇒ Object
- #start ⇒ Object
Constructor Details
#initialize(io, options = {}) ⇒ Bender
Returns a new instance of Bender.
27 28 29 30 31 32 33 34 |
# File 'lib/minitest/bender.rb', line 27 def initialize(io, = {}) @io = io @options = @previous_context = nil @results = [] @results_by_context = {} @time_ranking_is_relevant = false end |
Instance Attribute Details
#io ⇒ Object
Returns the value of attribute io.
8 9 10 |
# File 'lib/minitest/bender.rb', line 8 def io @io end |
#options ⇒ Object
Returns the value of attribute options.
8 9 10 |
# File 'lib/minitest/bender.rb', line 8 def @options end |
#previous_context ⇒ Object (readonly)
Returns the value of attribute previous_context.
9 10 11 |
# File 'lib/minitest/bender.rb', line 9 def previous_context @previous_context end |
#results ⇒ Object (readonly)
Returns the value of attribute results.
9 10 11 |
# File 'lib/minitest/bender.rb', line 9 def results @results end |
#results_by_context ⇒ Object (readonly)
Returns the value of attribute results_by_context.
9 10 11 |
# File 'lib/minitest/bender.rb', line 9 def results_by_context @results_by_context end |
#started_at ⇒ Object (readonly)
Returns the value of attribute started_at.
9 10 11 |
# File 'lib/minitest/bender.rb', line 9 def started_at @started_at end |
Class Method Details
.configuration ⇒ Object
22 23 24 |
# File 'lib/minitest/bender.rb', line 22 def configuration @configuration ||= MinitestBender::Configuration.new end |
.enable!(client_config = {}) ⇒ Object
12 13 14 15 16 |
# File 'lib/minitest/bender.rb', line 12 def enable!(client_config = {}) @is_enabled = true configuration.add_client_config(client_config) Colorizer.custom_colors = configuration.custom_colors end |
.enabled? ⇒ Boolean
18 19 20 |
# File 'lib/minitest/bender.rb', line 18 def enabled? @is_enabled ||= false end |
Instance Method Details
#passed? ⇒ Boolean
72 73 74 |
# File 'lib/minitest/bender.rb', line 72 def passed? passed_count + skipped_count == run_count end |
#record(minitest_result) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/minitest/bender.rb', line 45 def record(minitest_result) flush_stdio result = MinitestBender.result_factory.create(minitest_result) results << result current_context = result.context if current_context != previous_context recorder.print_context_with_results(previous_context, results_by_context[previous_context]) unless previous_context.nil? recorder.print_context(current_context) @previous_context = current_context end (results_by_context[current_context] ||= []) << result @time_ranking_is_relevant = true if result.time > 0.01 if run_count == total_tests_count recorder.print_context_with_results(current_context, results_by_context[current_context]) end recorder.print_result(result) io.flush end |
#report ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/minitest/bender.rb', line 76 def report if results.empty? print_no_tests_status return end io.puts io.puts print_divider(:normal) print_sections end |