Sha256: 3b6634a43e3640a1581cf475cdcf715a67fd294f8d161ce996cb7872683c4a79
Contents?: true
Size: 1.49 KB
Versions: 1
Compression:
Stored size: 1.49 KB
Contents
require_relative '../../../spec_helper' describe Arachni::Component::Options::Enum do before( :all ) do @opt = Arachni::Component::Options::Enum.new( '', [ false, 'Blah', nil, %w(1 2 3)] ) end describe '#valid?' do context 'when the value is valid' do it 'returns true' do @opt.valid?( '1' ).should be_true end end context 'when the value is not valid' do it 'returns false' do @opt.valid?( '4' ).should be_false end 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 'converts the string input into a boolean value' do @opt.normalize( '5' ).should be_nil @opt.normalize( '3' ).should == '3' @opt.normalize( 3 ).should == '3' end end describe '#desc' do it 'returns a description including the acceptable values' do @opt.desc.include?( 'Blah' ).should be_true @opt.enums.each { |v| @opt.desc.include?( v ).should be_true } @opt.desc = 'boo' @opt.desc.include?( 'boo' ).should be_true @opt.desc.include?( 'Blah' ).should be_false end end describe '#type' do it 'returns the option type as a string' do @opt.type.should == 'enum' end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
arachni-0.4.2 | spec/arachni/component/options/enum_spec.rb |