Sha256: 6101bd7f4834ec47361bd23d0068200450289fd49987f5805735976ccb978008

Contents?: true

Size: 406 Bytes

Versions: 5

Compression:

Stored size: 406 Bytes

Contents

require 'spec_helper'

describe OptParseValidator::OptInteger do
  subject(:opt) { described_class.new(['-i', '--int INT']) }

  describe '#validate' do
    context 'when not an integer' do
      it 'raises an error' do
        expect { opt.validate('a') }.to raise_error('a is not an integer')
      end
    end

    it 'returns the integer' do
      expect(opt.validate('12')).to eq 12
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
opt_parse_validator-0.0.9 spec/lib/opt_parse_validator/opts/integer_spec.rb
opt_parse_validator-0.0.8 spec/lib/opt_parse_validator/opts/integer_spec.rb
opt_parse_validator-0.0.7 spec/lib/opt_parse_validator/opts/integer_spec.rb
opt_parse_validator-0.0.6 spec/lib/opt_parse_validator/opts/integer_spec.rb
opt_parse_validator-0.0.5 spec/lib/opt_parse_validator/opts/integer_spec.rb