Sha256: e0dea0eb051af190ac472d1eca98b276047fe67caad7f6eddff78e0164ebed92

Contents?: true

Size: 1.12 KB

Versions: 4

Compression:

Stored size: 1.12 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 'should return 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 'should return 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 'should return false' do
                @opt.class.new( '', [true] ).valid?( nil ).should be_false
            end
        end
    end

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

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
arachni-0.4.1.3 spec/arachni/component/options/port_spec.rb
arachni-0.4.1.2 spec/arachni/component/options/port_spec.rb
arachni-0.4.1.1 spec/arachni/component/options/port_spec.rb
arachni-0.4.1 spec/arachni/component/options/port_spec.rb