Sha256: 4f48ef3eed4773c558bd0cd07aae4ee735997dd9ea0a3f84839814522a46bd10

Contents?: true

Size: 1.07 KB

Versions: 4

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 'should be false' do
                @server.ready?.should be_false
            end
        end

        context 'when the server is ready' do
            it 'should be 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

4 entries across 4 versions & 1 rubygems

Version Path
arachni-0.4.1.3 spec/arachni/rpc/server/base_spec.rb
arachni-0.4.1.2 spec/arachni/rpc/server/base_spec.rb
arachni-0.4.1.1 spec/arachni/rpc/server/base_spec.rb
arachni-0.4.1 spec/arachni/rpc/server/base_spec.rb