Sha256: e3617d5cdff2ec9db26ef0a5d28ff9b64cbfc08ecaae624e78cc14cd95c17309

Contents?: true

Size: 1.07 KB

Versions: 1

Compression:

Stored size: 1.07 KB

Contents

require_relative '../../../spec_helper'

require Arachni::Options.instance.dir['lib'] + 'rpc/client/base'
require Arachni::Options.instance.dir['lib'] + 'rpc/server/base'

require 'ostruct'

describe Arachni::RPC::Server::Base do
    before( :all ) do
        opts = Arachni::Options.instance
        opts.rpc_port = random_port
        @server = Arachni::RPC::Server::Base.new( opts )
    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

1 entries across 1 versions & 1 rubygems

Version Path
arachni-0.4.2 spec/arachni/rpc/server/base_spec.rb