Sha256: c0c25a1981d4dfed14d8f47f933653521bb05a7e36678573d61234e3e742e7ac

Contents?: true

Size: 629 Bytes

Versions: 1

Compression:

Stored size: 629 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) { |i| Egn.generate }.each do |egn|
        result = Egn::Validator.validate(egn)
        puts egn unless result
        expect(result).to be_true
      end
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

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