Class: ParallelRSpec::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/parallel_rspec/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(channel_to_server) ⇒ Client

Returns a new instance of Client.



5
6
7
# File 'lib/parallel_rspec/client.rb', line 5

def initialize(channel_to_server)
  @channel_to_server = channel_to_server
end

Instance Attribute Details

#channel_to_serverObject (readonly)

Returns the value of attribute channel_to_server.



3
4
5
# File 'lib/parallel_rspec/client.rb', line 3

def channel_to_server
  @channel_to_server
end

Instance Method Details

#deprecation(hash) ⇒ Object



37
38
39
# File 'lib/parallel_rspec/client.rb', line 37

def deprecation(hash)
  channel_to_server.write([:deprecation, hash])
end

#example_failed(example) ⇒ Object



25
26
27
# File 'lib/parallel_rspec/client.rb', line 25

def example_failed(example)
  channel_to_server.write([:example_failed, example.id, updates_from(example)])
end

#example_finished(example) ⇒ Object



29
30
31
# File 'lib/parallel_rspec/client.rb', line 29

def example_finished(example)
  channel_to_server.write([:example_finished, example.id, updates_from(example)])
end

#example_group_finished(group) ⇒ Object



13
14
15
# File 'lib/parallel_rspec/client.rb', line 13

def example_group_finished(group)
  # ditto
end

#example_group_started(group) ⇒ Object



9
10
11
# File 'lib/parallel_rspec/client.rb', line 9

def example_group_started(group)
  # not implemented yet - would need the same extraction/simplification for serialization as Example below
end

#example_passed(example) ⇒ Object



21
22
23
# File 'lib/parallel_rspec/client.rb', line 21

def example_passed(example)
  channel_to_server.write([:example_passed, example.id, updates_from(example)])
end

#example_pending(example) ⇒ Object



33
34
35
# File 'lib/parallel_rspec/client.rb', line 33

def example_pending(example)
  channel_to_server.write([:example_pending, example.id, updates_from(example)])
end

#example_started(example) ⇒ Object



17
18
19
# File 'lib/parallel_rspec/client.rb', line 17

def example_started(example)
  channel_to_server.write([:example_started, example.id, updates_from(example)])
end

#next_example_to_runObject



52
53
54
55
# File 'lib/parallel_rspec/client.rb', line 52

def next_example_to_run
  channel_to_server.write([:next_example_to_run])
  channel_to_server.read
end

#result(success) ⇒ Object



57
58
59
# File 'lib/parallel_rspec/client.rb', line 57

def result(success)
  channel_to_server.write([:result, success])
end

#updates_from(example) ⇒ Object



41
42
43
44
45
46
47
48
49
50
# File 'lib/parallel_rspec/client.rb', line 41

def updates_from(example)
  {
    exception: example.exception,
    metadata: example..slice(
      :execution_result,
      :pending,
      :skip,
    )
  }
end