Sha256: d4ecc20ebd35edb9c1e3f9640aa22483aac7b12fffa5c5ed5a41724680c76f50

Contents?: true

Size: 1.11 KB

Versions: 4

Compression:

Stored size: 1.11 KB

Contents

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

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

    describe '#valid?' do
        it 'should return true' do
            @opt.valid?( 'test' ).should be_true
            @opt.valid?( 999 ).should be_true
            @opt.valid?( true ).should be_true
        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 '#normalize' do
        it 'should return a string representation of the value' do
            @opt.normalize( 'test' ).should == 'test'
        end
        context 'when it is a file:// URL' do
            it 'should use that file\'s contents as a value' do
                @opt.normalize( 'file://' + __FILE__ ).should == IO.read( __FILE__ )
            end
        end
    end

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

end

Version data entries

4 entries across 4 versions & 1 rubygems

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