Sha256: 1a32207307277bbd5ce716de79b137110dbc0d8fc492077eee44e7bb7313e139

Contents?: true

Size: 619 Bytes

Versions: 4

Compression:

Stored size: 619 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)
        expect(result).to be_true, "Failed for #{egn}"
      end
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
egn-1.3.2 spec/egn/validator_spec.rb
egn-1.3.1 spec/egn/validator_spec.rb
egn-1.3.0 spec/egn/validator_spec.rb
egn-1.2.2 spec/egn/validator_spec.rb