Class: RSpec::ProgressTable::Formatter

Inherits:
Core::Formatters::ProgressFormatter
  • Object
show all
Defined in:
lib/rspec/progress_table/formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ Formatter



11
12
13
14
15
16
17
18
19
20
# File 'lib/rspec/progress_table/formatter.rb', line 11

def initialize(output)
  super
  DRb.start_service
  @server = if ENV["RSPEC_PROGRESS_TABLE_SERVER"]
    DRbObject.new_with_uri(ENV["RSPEC_PROGRESS_TABLE_SERVER"])
  else
    Server.start
    DRbObject.new_with_uri(DEFAULT_SERVER_URL)
  end
end

Instance Attribute Details

#serverObject (readonly)

Returns the value of attribute server.



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

def server
  @server
end

Instance Method Details

#dump_failures(notification) ⇒ Object



41
42
43
44
45
# File 'lib/rspec/progress_table/formatter.rb', line 41

def dump_failures(notification)
  return if notification.failure_notifications.empty?

  server.dump(notification.fully_formatted_failed_examples)
end

#dump_pending(notification) ⇒ Object



47
48
49
50
51
# File 'lib/rspec/progress_table/formatter.rb', line 47

def dump_pending(notification)
  return if notification.pending_examples.empty?

  server.dump(notification.fully_formatted_pending_examples)
end

#dump_summary(summary) ⇒ Object



53
54
55
# File 'lib/rspec/progress_table/formatter.rb', line 53

def dump_summary(summary)
  server.dump(summary.fully_formatted)
end

#example_failed(_) ⇒ Object



33
34
35
# File 'lib/rspec/progress_table/formatter.rb', line 33

def example_failed(_)
  server.failed(Process.pid)
end

#example_passed(_) ⇒ Object



29
30
31
# File 'lib/rspec/progress_table/formatter.rb', line 29

def example_passed(_)
  server.passed(Process.pid)
end

#example_pending(_) ⇒ Object



37
38
39
# File 'lib/rspec/progress_table/formatter.rb', line 37

def example_pending(_)
  server.pending(Process.pid)
end

#example_started(_) ⇒ Object



26
27
# File 'lib/rspec/progress_table/formatter.rb', line 26

def example_started(_)
end

#start(notification) ⇒ Object



22
23
24
# File 'lib/rspec/progress_table/formatter.rb', line 22

def start(notification)
  server.update_total(Process.pid, notification.count)
end