Sha256: 6f8d699d8f109c4e4dce1ad020a429df9e088dd1d24e3600c6949fcc21c094db

Contents?: true

Size: 988 Bytes

Versions: 6

Compression:

Stored size: 988 Bytes

Contents

require 'ap'
require 'timeout'
require_relative '../lib/arachni/rpc'
require_relative 'servers/server'

def cwd
    File.expand_path( File.dirname( __FILE__ ) )
end

def start_client( opts )
    Arachni::RPC::Client.new( opts )
end

def quiet_spawn( file )
    path = File.join( File.expand_path( File.dirname( __FILE__ ) ), 'servers', "#{file}.rb" )
    Process.spawn RbConfig.ruby, path#, out: '/dev/null'
end

server_pids = []
RSpec.configure do |config|
    config.color = true
    config.add_formatter :documentation

    config.before( :suite ) do
        File.delete( '/tmp/arachni-rpc-test' ) rescue nil

        files = %w(basic with_ssl_primitives)
        files << 'unix_socket' if Arachni::Reactor.supports_unix_sockets?

        files.each do |name|
            server_pids << quiet_spawn( name ).tap { |pid| Process.detach( pid ) }
        end
        sleep 5
    end

    config.after( :suite ) do
        server_pids.each { |pid| Process.kill( 'KILL', pid ) }
    end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
arachni-rpc-0.2.1.4 spec/spec_helper.rb
arachni-rpc-0.2.1.3 spec/spec_helper.rb
arachni-rpc-0.2.1.2 spec/spec_helper.rb
arachni-rpc-0.2.1.1 spec/spec_helper.rb
arachni-rpc-0.2.1 spec/spec_helper.rb
arachni-rpc-0.2.0 spec/spec_helper.rb