Sha256: f53f587576efc6c69686f12ee4bffd67f0b3a7b6b600ca56b524697883fd2c5f

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

require 'rspec'
require 'timeout'

require_relative '../lib/arachni/rpc/em'
require_relative 'servers/server'

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

def quiet_fork( &block )
    fork {
        #$stdout.reopen( '/dev/null', 'w' )
        #$stderr.reopen( '/dev/null', 'w' )
        block.call
    }
end

def quiet_spawn( file )
    Process.spawn 'ruby ' + file
end

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

    config.before( :suite ) do
        cwd = File.expand_path( File.dirname( __FILE__ ) )
        server_pids << quiet_spawn( File.join( cwd, 'servers', 'basic.rb' ) )
        server_pids << quiet_spawn( File.join( cwd, 'servers', 'with_ssl_primitives.rb' ) )
        server_pids << quiet_spawn( File.join( cwd, 'servers', 'with_fallback.rb' ) )
        server_pids << quiet_spawn( File.join( cwd, 'servers', 'unix_socket.rb' ) )
        server_pids.each { |pid| Process.detach( pid ) }
        sleep 2
    end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
arachni-rpc-em-0.2 spec/spec_helper.rb