Sha256: 40a68efe95bd32ed57ff3352aae6aa0b9333e6c5454531a6344c452a3989f1dd

Contents?: true

Size: 1.21 KB

Versions: 4

Compression:

Stored size: 1.21 KB

Contents

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

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

    describe '#valid?' do
        context 'when the value is valid' do
            it 'should return true' do
                @opt.valid?( '1' ).should be_true
                @opt.valid?( 1 ).should be_true
                @opt.valid?( 1.2 ).should be_true
            end
        end
        context 'when the value is not valid' do
            it 'should return false' do
                @opt.valid?( '4d' ).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 '#normalize' do
        it 'should convert the string input into a boolean value' do
            @opt.normalize( '5' ).should == 5.0
            @opt.normalize( '5.3' ).should == 5.3
            @opt.normalize( 3 ).should == 3.0
        end
    end

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

end

Version data entries

4 entries across 4 versions & 1 rubygems

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