Sha256: c1f9898b5a7e4e5b03d103f74b035ed3ad0dda3c45ca9a568019d63c5e93c3e9

Contents?: true

Size: 1.08 KB

Versions: 9

Compression:

Stored size: 1.08 KB

Contents

require '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

9 entries across 9 versions & 1 rubygems

Version Path
arachni-0.4.7 spec/arachni/component/options/port_spec.rb
arachni-0.4.6 spec/arachni/component/options/port_spec.rb
arachni-0.4.5.2 spec/arachni/component/options/port_spec.rb
arachni-0.4.5.1 spec/arachni/component/options/port_spec.rb
arachni-0.4.5 spec/arachni/component/options/port_spec.rb
arachni-0.4.4 spec/arachni/component/options/port_spec.rb
arachni-0.4.3.2 spec/arachni/component/options/port_spec.rb
arachni-0.4.3.1 spec/arachni/component/options/port_spec.rb
arachni-0.4.3 spec/arachni/component/options/port_spec.rb