Sha256: c51b7a38195db4fa9cfc5e66cb897e3da256b79eb939307fb498058ec454def8

Contents?: true

Size: 402 Bytes

Versions: 5

Compression:

Stored size: 402 Bytes

Contents

require 'spec_helper'

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

  describe '#validate' do
    context 'when not > 0' do
      it 'raises an error' do
        expect { opt.validate('-3') }.to raise_error('-3 is not > 0')
      end
    end

    it 'returns the integer' do
      expect(opt.validate('20')).to eq 20
    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/positive_integer_spec.rb
opt_parse_validator-0.0.8 spec/lib/opt_parse_validator/opts/positive_integer_spec.rb
opt_parse_validator-0.0.7 spec/lib/opt_parse_validator/opts/positive_integer_spec.rb
opt_parse_validator-0.0.6 spec/lib/opt_parse_validator/opts/positive_integer_spec.rb
opt_parse_validator-0.0.5 spec/lib/opt_parse_validator/opts/positive_integer_spec.rb