Sha256: 1dac96a79ee051ddcc494cd1fff24586468ec95cfb15e9f123ee1da5fb26b8d4

Contents?: true

Size: 1.11 KB

Versions: 10

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'

describe Arachni::Component::Options::Float do
    include_examples 'component_option'
    subject { described_class.new( '' ) }

    describe '#valid?' do
        context 'when the value is valid' do
            it 'returns true' do
                ['1', 1, '1.2'].each do |value|
                    subject.value = value
                    subject.valid?.should be_true
                end
            end
        end
        context 'when the value is not valid' do
            it 'returns false' do
                subject.value = '4d'
                subject.valid?.should be_false
            end
        end
    end

    describe '#normalize' do
        it 'converts the string input into a boolean value' do
            subject.value = '5'
            subject.normalize.should == 5.0

            subject.value = '5.3'
            subject.normalize.should == 5.3

            subject.value = 3
            subject.normalize.should == 3.0
        end
    end

    describe '#type' do
        it 'returns the option type as a string' do
            subject.type.should == :float
        end
    end

end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
arachni-1.2.1 spec/arachni/component/options/float_spec.rb
arachni-1.2 spec/arachni/component/options/float_spec.rb
arachni-1.1 spec/arachni/component/options/float_spec.rb
arachni-1.0.6 spec/arachni/component/options/float_spec.rb
arachni-1.0.5 spec/arachni/component/options/float_spec.rb
arachni-1.0.4 spec/arachni/component/options/float_spec.rb
arachni-1.0.3 spec/arachni/component/options/float_spec.rb
arachni-1.0.2 spec/arachni/component/options/float_spec.rb
arachni-1.0.1 spec/arachni/component/options/float_spec.rb
arachni-1.0 spec/arachni/component/options/float_spec.rb