Class: Fuubar
- Inherits:
-
RSpec::Core::Formatters::BaseTextFormatter
- Object
- RSpec::Core::Formatters::BaseTextFormatter
- Fuubar
- Defined in:
- lib/fuubar.rb,
lib/fuubar/output.rb
Defined Under Namespace
Classes: Output
Constant Summary collapse
- DEFAULT_PROGRESS_BAR_OPTIONS =
{ :format => ' %c/%C |%w>%i| %e ' }.freeze
Instance Attribute Summary collapse
-
#failed_count ⇒ Object
Returns the value of attribute failed_count.
-
#passed_count ⇒ Object
Returns the value of attribute passed_count.
-
#pending_count ⇒ Object
Returns the value of attribute pending_count.
-
#progress ⇒ Object
Returns the value of attribute progress.
Instance Method Summary collapse
- #dump_failures(_notification) ⇒ Object
- #example_failed(notification) ⇒ Object
- #example_passed(_notification) ⇒ Object
- #example_pending(_notification) ⇒ Object
-
#initialize(*args) ⇒ Fuubar
constructor
A new instance of Fuubar.
- #message(notification) ⇒ Object
- #output ⇒ Object
- #start(notification) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Fuubar
Returns a new instance of Fuubar.
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/fuubar.rb', line 24 def initialize(*args) super self.progress = ProgressBar.create( DEFAULT_PROGRESS_BAR_OPTIONS. merge(:throttle_rate => continuous_integration? ? 1.0 : nil). merge(:total => 0, :output => output, :autostart => false) ) end |
Instance Attribute Details
#failed_count ⇒ Object
Returns the value of attribute failed_count.
19 20 21 |
# File 'lib/fuubar.rb', line 19 def failed_count @failed_count end |
#passed_count ⇒ Object
Returns the value of attribute passed_count.
19 20 21 |
# File 'lib/fuubar.rb', line 19 def passed_count @passed_count end |
#pending_count ⇒ Object
Returns the value of attribute pending_count.
19 20 21 |
# File 'lib/fuubar.rb', line 19 def pending_count @pending_count end |
#progress ⇒ Object
Returns the value of attribute progress.
19 20 21 |
# File 'lib/fuubar.rb', line 19 def progress @progress end |
Instance Method Details
#dump_failures(_notification) ⇒ Object
85 86 87 88 89 90 |
# File 'lib/fuubar.rb', line 85 def dump_failures(_notification) # # We output each failure as it happens so we don't need to output them en # masse at the end of the run. # end |
#example_failed(notification) ⇒ Object
66 67 68 69 70 71 72 73 74 75 |
# File 'lib/fuubar.rb', line 66 def example_failed(notification) self.failed_count += 1 progress.clear output.puts notification.fully_formatted(failed_count) output.puts increment end |
#example_passed(_notification) ⇒ Object
54 55 56 57 58 |
# File 'lib/fuubar.rb', line 54 def example_passed(_notification) self.passed_count += 1 increment end |
#example_pending(_notification) ⇒ Object
60 61 62 63 64 |
# File 'lib/fuubar.rb', line 60 def example_pending(_notification) self.pending_count += 1 increment end |
#message(notification) ⇒ Object
77 78 79 80 81 82 83 |
# File 'lib/fuubar.rb', line 77 def (notification) if progress.respond_to? :log progress.log(notification.) else super end end |
#output ⇒ Object
92 93 94 |
# File 'lib/fuubar.rb', line 92 def output @fuubar_output ||= Fuubar::Output.new(super, configuration.tty?) end |
#start(notification) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/fuubar.rb', line 36 def start(notification) = DEFAULT_PROGRESS_BAR_OPTIONS. merge(:throttle_rate => continuous_integration? ? 1.0 : nil). merge(configuration.). merge(:total => notification.count, :output => output, :autostart => false) self.progress = ProgressBar.create() self.passed_count = 0 self.pending_count = 0 self.failed_count = 0 super with_current_color { progress.start } end |