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



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

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, serialize_example(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, serialize_example(example)])
end

#example_pending(example) ⇒ Object



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

def example_pending(example)
  channel_to_server.write([:example_pending, serialize_example(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, serialize_example(example)])
end

#serialize_example(example) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/parallel_rspec/client.rb', line 37

def serialize_example(example)
  Example.new(
    example.id,
    example.description,
    example.exception,
    example.location_rerun_argument,
    example..slice(
      :absolute_file_path,
      :described_class,
      :description,
      :description_args,
      :execution_result,
      :full_description,
      :file_path,
      :last_run_status,
      :line_number,
      :location,
      :pending,
      :rerun_file_path,
      :scoped_id,
      :shared_group_inclusion_backtrace,
      :type))
end