Sha256: 94f15e41aa929d7823cc94e0f5275356455562f6f73f2b4ecfe03c2f17656ad6

Contents?: true

Size: 1.46 KB

Versions: 9

Compression:

Stored size: 1.46 KB

Contents

require 'spec_helper'

describe Arachni::RPC::Server::Base do
    before( :all ) do
        opts = Arachni::Options.instance
        opts.rpc_port = available_port
        @server = Arachni::RPC::Server::Base.new( opts )
    end

    it 'supports UNIX sockets' do
        opts = Arachni::Options.instance
        opts.rpc_address = nil
        opts.rpc_port    = nil
        opts.rpc_socket  = '/tmp/arachni-base-server'
        server = Arachni::RPC::Server::Base.new( opts )

        Thread.new{ server.run }
        raised = false
        begin
            Timeout::timeout( 20 ){
                sleep 0.1 while !server.ready?
            }
        rescue Exception => e
            raised = true
        end

        server.ready?.should be_true
        raised.should be_false
    end

    describe '#ready?' do
        context 'when the server is not ready' do
            it 'returns false' do
                @server.ready?.should be_false
            end
        end

        context 'when the server is ready' do
            it 'returns true' do
                Thread.new{ @server.run }
                raised = false
                begin
                    Timeout::timeout( 20 ){
                        sleep 0.1 while !@server.ready?
                    }
                rescue Exception => e
                    raised = true
                end

                @server.ready?.should be_true
                raised.should be_false
            end
        end
    end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
arachni-0.4.7 spec/arachni/rpc/server/base_spec.rb
arachni-0.4.6 spec/arachni/rpc/server/base_spec.rb
arachni-0.4.5.2 spec/arachni/rpc/server/base_spec.rb
arachni-0.4.5.1 spec/arachni/rpc/server/base_spec.rb
arachni-0.4.5 spec/arachni/rpc/server/base_spec.rb
arachni-0.4.4 spec/arachni/rpc/server/base_spec.rb
arachni-0.4.3.2 spec/arachni/rpc/server/base_spec.rb
arachni-0.4.3.1 spec/arachni/rpc/server/base_spec.rb
arachni-0.4.3 spec/arachni/rpc/server/base_spec.rb