Sha256: 2780dcc942d4a315418af565c166739fff517e4c463938408c26f209d8ed8c76

Contents?: true

Size: 1.1 KB

Versions: 10

Compression:

Stored size: 1.1 KB

Contents

require 'spec_helper'

describe Arachni::Component::Options::Int 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, 0, '0'].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
                %w(sd 4d).each do |value|
                    subject.value = value
                    subject.valid?.should be_false
                end
            end
        end
    end

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

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

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

end

Version data entries

10 entries across 10 versions & 1 rubygems

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