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_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.
50 51 52 |
# File 'lib/parallel_rspec/client.rb', line 50 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.
48 49 50 |
# File 'lib/parallel_rspec/client.rb', line 48 def channel_to_server @channel_to_server end |
Instance Method Details
#deprecation(hash) ⇒ Object
74 75 76 |
# File 'lib/parallel_rspec/client.rb', line 74 def deprecation(hash) channel_to_server.write([:deprecation, hash]) end |
#dumpable_exception(exception) ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/parallel_rspec/client.rb', line 90 def dumpable_exception(exception) case exception when nil nil when ExceptionMarshallingWrapper exception when ::RSpec::Core::MultipleExceptionError::InterfaceTag MultipleExceptionMarshallingWrapper.new( exception.class.name, exception., exception.backtrace, dumpable_exception(exception.cause), exception.all_exceptions.map { |exception| dumpable_exception(exception) }, exception.aggregation_block_label, exception., exception.exception_count_description, ) else ExceptionMarshallingWrapper.new( exception.class.name, exception., exception.backtrace, dumpable_exception(exception.cause), ) end end |
#example_failed(example) ⇒ Object
62 63 64 |
# File 'lib/parallel_rspec/client.rb', line 62 def example_failed(example) channel_to_server.write([:example_failed, example.id, updates_from(example)]) end |
#example_finished(example) ⇒ Object
66 67 68 |
# File 'lib/parallel_rspec/client.rb', line 66 def example_finished(example) channel_to_server.write([:example_finished, example.id, updates_from(example)]) end |
#example_passed(example) ⇒ Object
58 59 60 |
# File 'lib/parallel_rspec/client.rb', line 58 def example_passed(example) channel_to_server.write([:example_passed, example.id, updates_from(example)]) end |
#example_pending(example) ⇒ Object
70 71 72 |
# File 'lib/parallel_rspec/client.rb', line 70 def example_pending(example) channel_to_server.write([:example_pending, example.id, updates_from(example)]) end |
#example_started(example) ⇒ Object
54 55 56 |
# File 'lib/parallel_rspec/client.rb', line 54 def example_started(example) channel_to_server.write([:example_started, example.id, updates_from(example)]) end |
#next_example_to_run ⇒ Object
117 118 119 120 121 |
# File 'lib/parallel_rspec/client.rb', line 117 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
123 124 125 |
# File 'lib/parallel_rspec/client.rb', line 123 def result(success) channel_to_server.write([:result, success]) end |
#updates_from(example) ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/parallel_rspec/client.rb', line 78 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 |