Sha256: b38806c36840af6426718cd404d9bad1df816a20dba860b4037f32daf9f5954b

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

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

    describe '#normalize' do
        it 'returns a string representation of the value' do
            @opt.normalize( 'test' ).should == 'test'
        end
        context 'when it is a file:// URL' do
            it 'uses that file\'s contents as a value' do
                @opt.normalize( 'file://' + __FILE__ ).should == IO.read( __FILE__ )
            end
        end
    end

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

end

Version data entries

1 entries across 1 versions & 1 rubygems

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