Class: EmojiFormatter
- Inherits:
-
Object
- Object
- EmojiFormatter
- Defined in:
- lib/emoji_formatter/formatter.rb
Constant Summary collapse
- PROGRESS_ICONS =
{ :example_passed => "\u{1f600}", :example_failed => "\u{1f621}", :example_pending => "\u{1f537}" }
Instance Method Summary collapse
- #dump_failures(notifications) ⇒ Object
- #dump_summary(summary) ⇒ Object
- #example_failed(_) ⇒ Object
- #example_passed(_) ⇒ Object
- #example_pending(_) ⇒ Object
-
#initialize(output) ⇒ EmojiFormatter
constructor
A new instance of EmojiFormatter.
- #start(_) ⇒ Object
Constructor Details
#initialize(output) ⇒ EmojiFormatter
Returns a new instance of EmojiFormatter.
14 15 16 |
# File 'lib/emoji_formatter/formatter.rb', line 14 def initialize(output) @output = output end |
Instance Method Details
#dump_failures(notifications) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/emoji_formatter/formatter.rb', line 34 def dump_failures(notifications) @output << "\n\n" notifications.failure_notifications.each_with_index do |notification, i| data = { i: i + 1, desc: notification.description } @output << "%4<i>s) %<desc>s\n" % data @output << " `bundle exec rspec #{notification.example.location_rerun_argument}`\n\n" notification..each do |line| @output << " #{line}\n" end notification.colorized_formatted_backtrace.each do |line| @output << " #{line}\n" end @output << "\n\n" end end |
#dump_summary(summary) ⇒ Object
54 55 56 57 58 59 60 |
# File 'lib/emoji_formatter/formatter.rb', line 54 def dump_summary(summary) final_stats = "#{summary.examples.count} examples:\ #{summary.failed_examples.count} #{PROGRESS_ICONS[:example_failed]} \ #{summary.pending_examples.count} #{PROGRESS_ICONS[:example_pending]} " @output << final_stats puts "" # without this we get a % at the end of the output... end |
#example_failed(_) ⇒ Object
26 27 28 |
# File 'lib/emoji_formatter/formatter.rb', line 26 def example_failed(_) example_result(:example_failed) end |
#example_passed(_) ⇒ Object
22 23 24 |
# File 'lib/emoji_formatter/formatter.rb', line 22 def example_passed(_) example_result(:example_passed) end |
#example_pending(_) ⇒ Object
30 31 32 |
# File 'lib/emoji_formatter/formatter.rb', line 30 def example_pending(_) example_result(:example_pending) end |
#start(_) ⇒ Object
18 19 20 |
# File 'lib/emoji_formatter/formatter.rb', line 18 def start(_) @output << "\n" end |