Class: ParallelRspecProgress::Controller

Inherits:
Object
  • Object
show all
Defined in:
lib/parallel_rspec_progress/controller.rb

Instance Method Summary collapse

Constructor Details

#initializeController

Returns a new instance of Controller.



7
8
9
10
11
12
# File 'lib/parallel_rspec_progress/controller.rb', line 7

def initialize
  @failed = []
  @passed = []
  @pending = []
  @total = 0
end

Instance Method Details

#add(key:, item:) ⇒ Object



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/parallel_rspec_progress/controller.rb', line 29

def add(key:, item:)
  case key
  when :failed
    @failed << item
  when :passed
    @passed << item
  when :pending
    @pending << item
  end

  @progressbar.title = compose_title
  @progressbar.increment
end

#put_total(val) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/parallel_rspec_progress/controller.rb', line 19

def put_total(val)
  if @progressbar
    @total += val
    @progressbar.total = @total
  else
    @total = val
    create_progressbar
  end
end

#stopObject



14
15
16
17
# File 'lib/parallel_rspec_progress/controller.rb', line 14

def stop
  DRb.stop_service
  process_results
end