Class: ParallelRSpec::Client
- Inherits:
-
Object
- Object
- ParallelRSpec::Client
- Defined in:
- lib/parallel_rspec/client.rb
Instance Attribute Summary collapse
-
#channel_to_server ⇒ Object
readonly
Returns the value of attribute channel_to_server.
Instance Method Summary collapse
- #deprecation(hash) ⇒ Object
- #dumpable_exception(exception) ⇒ Object
- #example_failed(example) ⇒ Object
- #example_finished(example) ⇒ Object
- #example_group_finished(group) ⇒ Object
- #example_group_started(group) ⇒ Object
- #example_passed(example) ⇒ Object
- #example_pending(example) ⇒ Object
- #example_started(example) ⇒ Object
-
#initialize(channel_to_server) ⇒ Client
constructor
A new instance of Client.
- #next_example_to_run ⇒ Object
- #result(success) ⇒ Object
- #updates_from(example) ⇒ Object
Constructor Details
#initialize(channel_to_server) ⇒ Client
Returns a new instance of Client.
34 35 36 |
# File 'lib/parallel_rspec/client.rb', line 34 def initialize(channel_to_server) @channel_to_server = channel_to_server end |
Instance Attribute Details
#channel_to_server ⇒ Object (readonly)
Returns the value of attribute channel_to_server.
32 33 34 |
# File 'lib/parallel_rspec/client.rb', line 32 def channel_to_server @channel_to_server end |
Instance Method Details
#deprecation(hash) ⇒ Object
66 67 68 |
# File 'lib/parallel_rspec/client.rb', line 66 def deprecation(hash) channel_to_server.write([:deprecation, hash]) end |
#dumpable_exception(exception) ⇒ Object
82 83 84 85 |
# File 'lib/parallel_rspec/client.rb', line 82 def dumpable_exception(exception) return exception if exception.nil? || exception.is_a?(ExceptionMarshallingWrapper) ExceptionMarshallingWrapper.new(exception.class.name, exception.to_s, exception.backtrace, dumpable_exception(exception.cause)) end |
#example_failed(example) ⇒ Object
54 55 56 |
# File 'lib/parallel_rspec/client.rb', line 54 def example_failed(example) channel_to_server.write([:example_failed, example.id, updates_from(example)]) end |
#example_finished(example) ⇒ Object
58 59 60 |
# File 'lib/parallel_rspec/client.rb', line 58 def example_finished(example) channel_to_server.write([:example_finished, example.id, updates_from(example)]) end |
#example_group_finished(group) ⇒ Object
42 43 44 |
# File 'lib/parallel_rspec/client.rb', line 42 def example_group_finished(group) # ditto end |
#example_group_started(group) ⇒ Object
38 39 40 |
# File 'lib/parallel_rspec/client.rb', line 38 def example_group_started(group) # not implemented yet - would need the same extraction/simplification for serialization as Example below end |
#example_passed(example) ⇒ Object
50 51 52 |
# File 'lib/parallel_rspec/client.rb', line 50 def example_passed(example) channel_to_server.write([:example_passed, example.id, updates_from(example)]) end |
#example_pending(example) ⇒ Object
62 63 64 |
# File 'lib/parallel_rspec/client.rb', line 62 def example_pending(example) channel_to_server.write([:example_pending, example.id, updates_from(example)]) end |
#example_started(example) ⇒ Object
46 47 48 |
# File 'lib/parallel_rspec/client.rb', line 46 def example_started(example) channel_to_server.write([:example_started, example.id, updates_from(example)]) end |
#next_example_to_run ⇒ Object
87 88 89 90 91 |
# File 'lib/parallel_rspec/client.rb', line 87 def next_example_to_run return nil if RSpec.world.wants_to_quit channel_to_server.write([:next_example_to_run]) channel_to_server.read end |
#result(success) ⇒ Object
93 94 95 |
# File 'lib/parallel_rspec/client.rb', line 93 def result(success) channel_to_server.write([:result, success]) end |
#updates_from(example) ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/parallel_rspec/client.rb', line 70 def updates_from(example) example.execution_result.exception = dumpable_exception(example.execution_result.exception) { exception: dumpable_exception(example.exception), metadata: example..slice( :execution_result, :pending, :skip, ) } end |