Class: ParallelProgressFormatter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ ParallelProgressFormatter

Returns a new instance of ParallelProgressFormatter.



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

def initialize(output)
  @output = output
  @controller = DRbObject.new_with_uri('druby://localhost:9999')
end

Instance Attribute Details

#controllerObject (readonly)

Returns the value of attribute controller.



12
13
14
# File 'lib/parallel_rspec_progress/formatter.rb', line 12

def controller
  @controller
end

Instance Method Details

#close(notification) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/parallel_rspec_progress/formatter.rb', line 23

def close(notification)
  if ParallelTests.last_process?
    ParallelTests.wait_for_other_processes_to_finish

    controller.stop
  end
end

#example_failed(notification) ⇒ Object



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

def example_failed(notification)
  controller.add(key: :failed, item: notification.example.location)
end

#example_passed(notification) ⇒ Object



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

def example_passed(notification)
  controller.add(key: :passed, item: notification.example.location)
end

#example_pending(notification) ⇒ Object



39
40
41
# File 'lib/parallel_rspec_progress/formatter.rb', line 39

def example_pending(notification)
  controller.add(key: :pending, item: notification.example.location)
end

#start(notification) ⇒ Object



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

def start(notification)
  controller.put_total(notification.count)
end