Class: RSpec::Risky::Formatter
- Inherits:
-
Core::Formatters::BaseTextFormatter
- Object
- Core::Formatters::BaseTextFormatter
- RSpec::Risky::Formatter
- Defined in:
- lib/rspec/risky/formatter.rb,
sig/rspec/risky.rbs
Instance Method Summary collapse
- #dump_summary(summary) ⇒ Object
- #example_failed(notification) ⇒ Object
- #example_passed(notification) ⇒ Object
- #example_pending(notification) ⇒ Object
-
#initialize(output) ⇒ Formatter
constructor
A new instance of Formatter.
- #start_dump(_notification) ⇒ Object
Constructor Details
#initialize(output) ⇒ Formatter
Returns a new instance of Formatter.
17 18 19 20 |
# File 'lib/rspec/risky/formatter.rb', line 17 def initialize(output) super @examples = [] end |
Instance Method Details
#dump_summary(summary) ⇒ Object
43 44 45 46 47 |
# File 'lib/rspec/risky/formatter.rb', line 43 def dump_summary(summary) dump_risky_examples dump_assertion_density super end |
#example_failed(notification) ⇒ Object
34 35 36 37 |
# File 'lib/rspec/risky/formatter.rb', line 34 def example_failed(notification) @examples << notification.example output.print ::RSpec::Core::Formatters::ConsoleCodes.wrap("F", :failure) end |
#example_passed(notification) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/rspec/risky/formatter.rb', line 22 def example_passed(notification) @examples << notification.example marker = risky?(notification.example) ? "R" : "." color = risky?(notification.example) ? :pending : :success output.print ::RSpec::Core::Formatters::ConsoleCodes.wrap(marker, color) end |
#example_pending(notification) ⇒ Object
29 30 31 32 |
# File 'lib/rspec/risky/formatter.rb', line 29 def example_pending(notification) @examples << notification.example output.print ::RSpec::Core::Formatters::ConsoleCodes.wrap("*", :pending) end |
#start_dump(_notification) ⇒ Object
39 40 41 |
# File 'lib/rspec/risky/formatter.rb', line 39 def start_dump(_notification) output.puts end |