lib/fuubar.rb in fuubar-1.3.3 vs lib/fuubar.rb in fuubar-2.0.0.beta1

- old
+ new

@@ -5,72 +5,72 @@ RSpec.configuration.add_setting :fuubar_progress_bar_options, :default => {} class Fuubar < RSpec::Core::Formatters::BaseTextFormatter DEFAULT_PROGRESS_BAR_OPTIONS = { :format => ' %c/%C |%w>%i| %e ' } + RSpec::Core::Formatters.register self, :start, + :message, + :example_passed, + :example_pending, + :example_failed, + :dump_failures + attr_accessor :progress 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 - - def start(example_count) progress_bar_options = DEFAULT_PROGRESS_BAR_OPTIONS. merge(:throttle_rate => continuous_integration? ? 1.0 : nil). merge(configuration.fuubar_progress_bar_options). - merge(:total => example_count, + merge(:total => 0, :output => output, :autostart => false) self.progress = ProgressBar.create(progress_bar_options) + end + def start(notification) super - progress.total = example_count + progress.total = notification.count with_current_color { progress.start } end - def example_passed(example) - super - + def example_passed(notification) increment end - def example_pending(example) + def example_pending(notification) super increment end - def example_failed(example) + def example_failed(notification) super + example = notification.example progress.clear dump_failure example, failed_examples.size - 1 dump_backtrace example output.puts increment end - def message(string) + def message(notification) if progress.respond_to? :log - progress.log(string) + progress.log(notification.message) else super end end - def dump_failures + 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