Sha256: 050c7765c1ceed0cfeb86d2771d5a78dfc40906741bf6a0fe1659525851d1708

Contents?: true

Size: 981 Bytes

Versions: 1

Compression:

Stored size: 981 Bytes

Contents

require 'rspec'
require 'timeout'

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

require File.join( cwd, '../lib/arachni/rpc/', 'em' )
require File.join( cwd, '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
        server_pids << quiet_spawn( File.join( cwd, 'servers', 'basic.rb' ) )
        server_pids << quiet_spawn( File.join( cwd, 'servers', 'with_ssl_primitives.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.1.2 spec/spec_helper.rb