class RSpec::Core::Bisect::Server

@private A DRb server that receives run results from a separate RSpec process started by the bisect process.

Attributes

expected_failures[RW]

Fetched via DRb by the BisectFormatter to determine when to abort.

latest_run_results[RW]

Set via DRb by the BisectFormatter with the results of the run.

Public Class Methods

run() { |server| ... } click to toggle source
# File lib/rspec/core/bisect/server.rb, line 15
def self.run
  server = new
  server.start
  yield server
ensure
  server.stop
end

Public Instance Methods

capture_run_results(expected_failures=[]) { || ... } click to toggle source
# File lib/rspec/core/bisect/server.rb, line 23
def capture_run_results(expected_failures=[])
  self.expected_failures  = expected_failures
  self.latest_run_results = nil
  run_output = yield
  latest_run_results || raise_bisect_failed(run_output)
end
drb_port() click to toggle source
# File lib/rspec/core/bisect/server.rb, line 42
def drb_port
  @drb_port ||= Integer(@drb.uri[/\d+$/])
end
start() click to toggle source
# File lib/rspec/core/bisect/server.rb, line 30
def start
  # Only allow remote DRb requests from this machine.
  DRb.install_acl ACL.new(%w[ deny all allow localhost allow 127.0.0.1 ])

  # We pass `nil` as the first arg to allow it to pick a DRb port.
  @drb = DRb.start_service(nil, self)
end
stop() click to toggle source
# File lib/rspec/core/bisect/server.rb, line 38
def stop
  @drb.stop_service
end

Private Instance Methods

raise_bisect_failed(run_output) click to toggle source
# File lib/rspec/core/bisect/server.rb, line 54
def raise_bisect_failed(run_output)
  raise BisectFailedError, "Failed to get results from the spec "                  "run. Spec run output:\n\n#{run_output}"
end