Class: Doggo
- Inherits:
-
RSpec::Core::Formatters::BaseTextFormatter
- Object
- RSpec::Core::Formatters::BaseTextFormatter
- Doggo
- Defined in:
- lib/doggo.rb
Instance Attribute Summary collapse
-
#current_example_index ⇒ Object
Returns the value of attribute current_example_index.
-
#example_running ⇒ Object
Returns the value of attribute example_running.
-
#failed_count ⇒ Object
Returns the value of attribute failed_count.
-
#group_level ⇒ Object
Returns the value of attribute group_level.
-
#messages ⇒ Object
Returns the value of attribute messages.
-
#outstr ⇒ Object
Returns the value of attribute outstr.
-
#pad ⇒ Object
Returns the value of attribute pad.
-
#passed_count ⇒ Object
Returns the value of attribute passed_count.
-
#pending_count ⇒ Object
Returns the value of attribute pending_count.
-
#total_count ⇒ Object
Returns the value of attribute total_count.
Instance Method Summary collapse
- #example_failed(failure) ⇒ Object
- #example_group_finished(_notification) ⇒ Object
- #example_group_started(notification) ⇒ Object
- #example_passed(passed) ⇒ Object
- #example_pending(pending) ⇒ Object
- #example_started(_notification) ⇒ Object
-
#initialize(output) ⇒ Doggo
constructor
A new instance of Doggo.
- #message(notification) ⇒ Object
- #start(notification) ⇒ Object
Constructor Details
#initialize(output) ⇒ Doggo
Returns a new instance of Doggo.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/doggo.rb', line 33 def initialize(output) @outstr = output @example_running = false @current_example_index = 0 @group_level = 0 = [] @total_count = 0 @pad = nil @passed_count = 0 @pending_count = 0 @failed_count = 0 super end |
Instance Attribute Details
#current_example_index ⇒ Object
Returns the value of attribute current_example_index.
18 19 20 |
# File 'lib/doggo.rb', line 18 def current_example_index @current_example_index end |
#example_running ⇒ Object
Returns the value of attribute example_running.
18 19 20 |
# File 'lib/doggo.rb', line 18 def example_running @example_running end |
#failed_count ⇒ Object
Returns the value of attribute failed_count.
18 19 20 |
# File 'lib/doggo.rb', line 18 def failed_count @failed_count end |
#group_level ⇒ Object
Returns the value of attribute group_level.
18 19 20 |
# File 'lib/doggo.rb', line 18 def group_level @group_level end |
#messages ⇒ Object
Returns the value of attribute messages.
18 19 20 |
# File 'lib/doggo.rb', line 18 def end |
#outstr ⇒ Object
Returns the value of attribute outstr.
18 19 20 |
# File 'lib/doggo.rb', line 18 def outstr @outstr end |
#pad ⇒ Object
Returns the value of attribute pad.
18 19 20 |
# File 'lib/doggo.rb', line 18 def pad @pad end |
#passed_count ⇒ Object
Returns the value of attribute passed_count.
18 19 20 |
# File 'lib/doggo.rb', line 18 def passed_count @passed_count end |
#pending_count ⇒ Object
Returns the value of attribute pending_count.
18 19 20 |
# File 'lib/doggo.rb', line 18 def pending_count @pending_count end |
#total_count ⇒ Object
Returns the value of attribute total_count.
18 19 20 |
# File 'lib/doggo.rb', line 18 def total_count @total_count end |
Instance Method Details
#example_failed(failure) ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/doggo.rb', line 94 def example_failed(failure) self.failed_count += 1 self.outstr.puts(failure_output(failure.example)) self.outstr.puts(failure.fully_formatted(self.failed_count)) self.outstr.puts("\n") () self.example_running = false end |
#example_group_finished(_notification) ⇒ Object
68 69 70 |
# File 'lib/doggo.rb', line 68 def example_group_finished(_notification) self.group_level -= 1 if self.group_level > 0 end |
#example_group_started(notification) ⇒ Object
61 62 63 64 65 66 |
# File 'lib/doggo.rb', line 61 def example_group_started(notification) self.outstr.puts() if self.group_level == 0 self.outstr.puts("#{group_progress()}#{current_indentation}#{notification.group.description.strip}") self.group_level += 1 end |
#example_passed(passed) ⇒ Object
72 73 74 75 76 77 78 |
# File 'lib/doggo.rb', line 72 def example_passed(passed) self.outstr.puts(passed_output(passed.example)) () self.passed_count += 1 self.example_running = false end |
#example_pending(pending) ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/doggo.rb', line 80 def example_pending(pending) self.outstr.puts( pending_output( pending.example, pending.example.execution_result. ) ) () self.pending_count += 1 self.example_running = false end |
#example_started(_notification) ⇒ Object
56 57 58 59 |
# File 'lib/doggo.rb', line 56 def example_started(_notification) self.example_running = true self.current_example_index += 1 end |
#message(notification) ⇒ Object
106 107 108 109 110 111 112 |
# File 'lib/doggo.rb', line 106 def (notification) if self.example_running self. << notification. else self.outstr.puts("#{group_progress()}#{current_indentation}#{notification.message}") end end |
#start(notification) ⇒ Object
50 51 52 53 54 |
# File 'lib/doggo.rb', line 50 def start(notification) self.total_count = notification.count self.pad = notification.count.to_s.size super end |