Sha256: c2ec161eb39f331dabc9619365c1ce61d79d09e30c59cdd9a96173d7aa9c69c5

Contents?: true

Size: 613 Bytes

Versions: 1

Compression:

Stored size: 613 Bytes

Contents

require 'spec_helper'

describe Egn::Validator do
  describe '#validate' do
    it 'fails for strings with incorrect size' do
      expect(Egn::Validator.validate('123456789')).to be_false
      expect(Egn::Validator.validate('12345678901')).to be_false
    end

    it 'fails for incorrect dates' do
      expect(Egn::Validator.validate('6101347500')).to be_false
    end

    it 'checks 10 000 of the generated numbers' do
      Array.new(10_000) { |_| Egn.generate }.each do |egn|
        result = Egn::Validator.validate(egn)
        expect(result).to be_true, "Failed for #{egn}"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
egn-1.3.3 spec/egn/validator_spec.rb