Class: RspecProgressBar::Formatter

Inherits:
RSpec::Core::Formatters::BaseTextFormatter
  • Object
show all
Defined in:
lib/rspec_progress_bar/formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ Formatter

Returns a new instance of Formatter.



11
12
13
# File 'lib/rspec_progress_bar/formatter.rb', line 11

def initialize(output)
  @output = output
end

Instance Attribute Details

#progress_barObject

Returns the value of attribute progress_bar.



9
10
11
# File 'lib/rspec_progress_bar/formatter.rb', line 9

def progress_bar
  @progress_bar
end

Instance Method Details

#example_started(_notification) ⇒ Object



19
20
21
22
# File 'lib/rspec_progress_bar/formatter.rb', line 19

def example_started(_notification)
  progress_bar.count += 1
  @output << "#{progress_bar}\r"
end

#start(notification) ⇒ Object



15
16
17
# File 'lib/rspec_progress_bar/formatter.rb', line 15

def start(notification)
  @progress_bar = ProgressBar.new(notification.count)
end