Sha256: a4ca268b30ed2fb425ea739a96de6591f49c99f7d6eb83e618352d7cdeb86da9
Contents?: true
Size: 731 Bytes
Versions: 17
Compression:
Stored size: 731 Bytes
Contents
require 'test_helper' module Eac class CpfValidatorTest < ActiveSupport::TestCase class M1 include ActiveModel::Model attr_accessor :cpf validates :cpf, 'eac/cpf' => true, allow_nil: true end def setup @record = M1.new end def test_valid_cpfs ['85630275305', '66244374487', nil].each do |v| @record.cpf = v @record.valid? assert_equal [], @record.errors[:cpf], "CPF: \"#{v}\"" end end def test_invalid_cpfs ['', ' ', 'abc', '856.302.753-05', '662.443.744-87', '85630275304'].each do |v| @record.cpf = v @record.valid? assert_not_equal [], @record.errors[:cpf], "CPF: \"#{v}\"" end end end end
Version data entries
17 entries across 17 versions & 1 rubygems