Sha256: bd90408d9409a1f0275d5f83ec0a28826ce51165081f2e3db8646ce6af25514d

Contents?: true

Size: 866 Bytes

Versions: 2

Compression:

Stored size: 866 Bytes

Contents

#coding: utf-8
require 'test_helper'

describe Rut do
  describe "validations" do
    it "should detect invalid ruts" do
      Rut.valid?(1).must_equal false
      Rut.valid?(123).must_equal false
      Rut.valid?("1040").must_equal false
      Rut.valid?("10005").must_equal false
      Rut.valid?("100003").must_equal false
      Rut.valid?("1000011").must_equal false
      Rut.valid?("79567729").must_equal false
      Rut.valid?("14569484k").must_equal false
    end
    it "should recognize valid ruts" do
      Rut.valid?(19).must_equal true
      Rut.valid?(124).must_equal true
      Rut.valid?("104k").must_equal true
      Rut.valid?("10006").must_equal true
      Rut.valid?("100005").must_equal true
      Rut.valid?("1000012").must_equal true
      Rut.valid?("79567728").must_equal true
      Rut.valid?("145694841").must_equal true
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rutcl-1.0.0 test/unit/rut_validations_test.rb
rutcl-0.0.1 test/unit/rut_validations_test.rb