Class: Fuubar
- Inherits:
-
RSpec::Core::Formatters::BaseTextFormatter
- Object
- RSpec::Core::Formatters::BaseTextFormatter
- Fuubar
- Defined in:
- lib/fuubar.rb
Constant Summary collapse
- DEFAULT_PROGRESS_BAR_OPTIONS =
{ :format => ' %c/%C |%w>%i| %e ' }
Instance Attribute Summary collapse
-
#progress ⇒ Object
Returns the value of attribute progress.
Instance Method Summary collapse
- #dump_failures ⇒ Object
- #example_failed(example) ⇒ Object
- #example_passed(example) ⇒ Object
- #example_pending(example) ⇒ Object
-
#initialize(*args) ⇒ Fuubar
constructor
A new instance of Fuubar.
- #message(string) ⇒ Object
- #start(example_count) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Fuubar
Returns a new instance of Fuubar.
12 13 14 15 16 17 18 19 20 |
# File 'lib/fuubar.rb', line 12 def initialize(*args) super self.progress = ProgressBar.create(DEFAULT_PROGRESS_BAR_OPTIONS. merge(:throttle_rate => continuous_integration? ? 1.0 : nil). merge(:total => example_count, :output => output, :autostart => false)) end |
Instance Attribute Details
#progress ⇒ Object
Returns the value of attribute progress.
10 11 12 |
# File 'lib/fuubar.rb', line 10 def progress @progress end |
Instance Method Details
#dump_failures ⇒ Object
72 73 74 75 76 77 |
# File 'lib/fuubar.rb', line 72 def dump_failures # # 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(example) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/fuubar.rb', line 51 def example_failed(example) super progress.clear dump_failure example, failed_examples.size - 1 dump_backtrace example output.puts increment end |
#example_passed(example) ⇒ Object
39 40 41 42 43 |
# File 'lib/fuubar.rb', line 39 def example_passed(example) super increment end |
#example_pending(example) ⇒ Object
45 46 47 48 49 |
# File 'lib/fuubar.rb', line 45 def example_pending(example) super increment end |
#message(string) ⇒ Object
64 65 66 67 68 69 70 |
# File 'lib/fuubar.rb', line 64 def (string) if progress.respond_to? :log progress.log(string) else super end end |
#start(example_count) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/fuubar.rb', line 22 def start(example_count) = DEFAULT_PROGRESS_BAR_OPTIONS. merge(:throttle_rate => continuous_integration? ? 1.0 : nil). merge(configuration.). merge(:total => example_count, :output => output, :autostart => false) self.progress = ProgressBar.create() super progress.total = example_count with_current_color { progress.start } end |