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.
51 52 53 |
# File 'lib/parallel_rspec/client.rb', line 51 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.
49 50 51 |
# File 'lib/parallel_rspec/client.rb', line 49 def channel_to_server @channel_to_server end |
Instance Method Details
#deprecation(hash) ⇒ Object
75 76 77 |
# File 'lib/parallel_rspec/client.rb', line 75 def deprecation(hash) channel_to_server.write([:deprecation, hash]) end |
#dumpable_exception(exception) ⇒ Object
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 116 117 |
# File 'lib/parallel_rspec/client.rb', line 91 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, exception.summary, ) else ExceptionMarshallingWrapper.new( exception.class.name, exception., exception.backtrace, dumpable_exception(exception.cause), ) end end |
#example_failed(example) ⇒ Object
63 64 65 |
# File 'lib/parallel_rspec/client.rb', line 63 def example_failed(example) channel_to_server.write([:example_failed, example.id, updates_from(example)]) end |
#example_finished(example) ⇒ Object
67 68 69 |
# File 'lib/parallel_rspec/client.rb', line 67 def example_finished(example) channel_to_server.write([:example_finished, example.id, updates_from(example)]) end |
#example_passed(example) ⇒ Object
59 60 61 |
# File 'lib/parallel_rspec/client.rb', line 59 def example_passed(example) channel_to_server.write([:example_passed, example.id, updates_from(example)]) end |
#example_pending(example) ⇒ Object
71 72 73 |
# File 'lib/parallel_rspec/client.rb', line 71 def example_pending(example) channel_to_server.write([:example_pending, example.id, updates_from(example)]) end |
#example_started(example) ⇒ Object
55 56 57 |
# File 'lib/parallel_rspec/client.rb', line 55 def example_started(example) channel_to_server.write([:example_started, example.id, updates_from(example)]) end |
#next_example_to_run ⇒ Object
119 120 121 122 123 |
# File 'lib/parallel_rspec/client.rb', line 119 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
125 126 127 |
# File 'lib/parallel_rspec/client.rb', line 125 def result(success) channel_to_server.write([:result, success]) end |
#updates_from(example) ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/parallel_rspec/client.rb', line 79 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 |