Class: RspecProgressExtended::Formatter

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

Instance Method Summary collapse

Instance Method Details

#example_failed(_notification) ⇒ Object



30
31
32
33
# File 'lib/rspec_progress_extended/formatter.rb', line 30

def example_failed(_notification)
  output.print RSpec::Core::Formatters::ConsoleCodes.wrap('F', :failure)
  print_progress
end

#example_passed(_notification) ⇒ Object



20
21
22
23
# File 'lib/rspec_progress_extended/formatter.rb', line 20

def example_passed(_notification)
  output.print RSpec::Core::Formatters::ConsoleCodes.wrap('.', :success)
  print_progress
end

#example_pending(_notification) ⇒ Object



25
26
27
28
# File 'lib/rspec_progress_extended/formatter.rb', line 25

def example_pending(_notification)
  output.print RSpec::Core::Formatters::ConsoleCodes.wrap('*', :pending)
  print_progress
end


13
14
15
16
17
18
# File 'lib/rspec_progress_extended/formatter.rb', line 13

def print_progress
  @i += 1
  if @i % 80 == 0
    output.puts " #{@i}/#{@total}"
  end
end

#start(notification) ⇒ Object



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

def start(notification)
  @i = 0
  @total = notification.count
end

#start_dump(_notification) ⇒ Object



35
36
37
# File 'lib/rspec_progress_extended/formatter.rb', line 35

def start_dump(_notification)
  output.puts
end