Class: RSpecQueue::Worker
- Inherits:
-
Object
- Object
- RSpecQueue::Worker
- Defined in:
- lib/rspec_queue/worker.rb
Instance Method Summary collapse
- #current_example ⇒ Object
- #finish(reporter) ⇒ Object
- #has_work? ⇒ Boolean
-
#initialize ⇒ Worker
constructor
A new instance of Worker.
Constructor Details
#initialize ⇒ Worker
Returns a new instance of Worker.
6 7 8 9 10 11 12 13 |
# File 'lib/rspec_queue/worker.rb', line 6 def initialize @server_socket = ENV["RSPEC_QUEUE_SERVER_ADDRESS"] socket = UNIXSocket.open(@server_socket) socket.puts "REGISTER" @uuid = socket.gets.to_s.strip end |
Instance Method Details
#current_example ⇒ Object
27 28 29 |
# File 'lib/rspec_queue/worker.rb', line 27 def current_example @example_group_key end |
#finish(reporter) ⇒ Object
31 32 33 34 35 36 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/rspec_queue/worker.rb', line 31 def finish(reporter) socket = UNIXSocket.open(@server_socket) socket.puts "FINISH" = socket.gets.to_s.strip if ( == "GET_UUID") socket.puts @uuid else puts "warn" end = socket.gets.to_s.strip # serialize the rspec reporter results back to the server if ( == "GET_RESULTS") results = reporter.examples.map { |e| { location: e.[:location], status: e.[:execution_result].status, run_time: e.[:execution_result].run_time } } socket.puts results.to_json else puts "warn" end end |
#has_work? ⇒ Boolean
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/rspec_queue/worker.rb', line 15 def has_work? socket = UNIXSocket.open(@server_socket) socket.puts "GET_WORK" = socket.gets.to_s.strip if == "SHUT_DOWN" false else @example_group_key = end end |