Sha256: 6134c9c5d2f019a87293313e5bf5347250c77821fa64ab955630ca99538fde9d

Contents?: true

Size: 954 Bytes

Versions: 6

Compression:

Stored size: 954 Bytes

Contents

require "drb/drb"

module Spec
  module Runner
    # Facade to run specs by connecting to a DRB server
    class DrbCommandLine

      def self.port(options)
        (options.drb_port || ENV["RSPEC_DRB"] || 8989).to_i
      end

      # Runs specs on a DRB server. Note that this API is similar to that of
      # CommandLine - making it possible for clients to use both interchangeably.
      def self.run(options)
        begin
          begin; \
            DRb.start_service("druby://localhost:0"); \
          rescue SocketError, Errno::EADDRNOTAVAIL; \
            DRb.start_service("druby://:0"); \
          end
          spec_server = DRbObject.new_with_uri("druby://127.0.0.1:#{port(options)}")
          spec_server.run(options.argv, options.error_stream, options.output_stream)
          true
        rescue DRb::DRbConnError
          options.error_stream.puts "No server is running"
          false
        end
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
rspec-instructure-1.3.3 lib/spec/runner/drb_command_line.rb
radiant-1.0.0 ruby-debug/ruby/1.8/gems/rspec-1.3.2/lib/spec/runner/drb_command_line.rb
rspec-1.3.2 lib/spec/runner/drb_command_line.rb
rspec-1.3.1 lib/spec/runner/drb_command_line.rb
rspec-1.3.1.rc lib/spec/runner/drb_command_line.rb
rspec-1.3.0 lib/spec/runner/drb_command_line.rb