Sha256: 93cd840c29091c2d1d87aa9d37d436ce046a889184ebd15d841da3d02a1b7d57

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

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

describe Arachni::Component::Options::Port do
    before( :all ) do
        @opt = Arachni::Component::Options::Port.new( '' )
    end

    describe '#valid?' do
        context 'when the path exists' do
            it 'returns true' do
                (1..65535).each do |p|
                    @opt.valid?( p ).should be_true
                    @opt.valid?( p.to_s ).should be_true
                end
            end
        end
        context 'when the path does not exist' do
            it 'returns false' do
                @opt.valid?( 'dd' ).should be_false
                @opt.valid?( -1 ).should be_false
                @opt.valid?( 0 ).should be_false
                @opt.valid?( 999999 ).should be_false
            end
        end
        context 'when required but empty' do
            it 'returns false' do
                @opt.class.new( '', [true] ).valid?( nil ).should be_false
            end
        end
    end

    describe '#type' do
        it 'returns the option type as a string' do
            @opt.type.should == 'port'
        end
    end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
arachni-0.4.2 spec/arachni/component/options/port_spec.rb