Class: RspecSpinner::Spinner

Inherits:
RspecSpinnerBase
  • Object
show all
Defined in:
lib/rspec_spinner/spinner.rb

Constant Summary

Constants inherited from RspecSpinnerBase

RspecSpinnerBase::ERROR_STATE_COLORS, RspecSpinnerBase::THRESHOLD

Instance Attribute Summary

Attributes inherited from RspecSpinnerBase

#current, #total

Instance Method Summary collapse

Methods inherited from RspecSpinnerBase

#dump_failure, #erase_current_line, #example_failed, #example_passed, #example_pending, #immediately_dump_failure, #immediately_dump_pending, #increment, #initialize, #mark_error_state_failed, #mark_error_state_pending, #method_missing, #print_warning_if_slow, #start_dump, #with_color

Constructor Details

This class inherits a constructor from RspecSpinner::RspecSpinnerBase

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RspecSpinner::RspecSpinnerBase

Instance Method Details

#clean_text(text) ⇒ Object



19
20
21
# File 'lib/rspec_spinner/spinner.rb', line 19

def clean_text(text)
  text.respond_to?(:gsub) ? text.gsub(/\r|\n|\t/, "") : "No Description"
end

#example_started(example) ⇒ Object



13
14
15
16
17
# File 'lib/rspec_spinner/spinner.rb', line 13

def example_started(example)
  desc = clean_text example.respond_to?(:description) ? example.description : example
  @pbar.subject = desc
  super
end

#start(example_count) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/rspec_spinner/spinner.rb', line 4

def start(example_count)
  @current     = 0
  @total       = example_count
  @error_state = :all_passing
  @pbar        = RTUI::Progress.new("#{example_count} examples", example_count,
  {:out => output, :components => [:percentage, :spinner, :subject, :stat]})
  @pbar.subject = "Starting..."
end