Sha256: af56daf54984046b862641b4d0d93878003609b39468dabe28ab8a41b5b2d5e6
Contents?: true
Size: 590 Bytes
Versions: 2
Compression:
Stored size: 590 Bytes
Contents
# frozen_string_literal: true require 'shoulda-matchers' module Shoulda module Matchers module ActiveModel def require_a_valid_cpf(attr = :cpf) RequireAValidCpfMatcher.new(attr) end class RequireAValidCpfMatcher < ValidationMatcher def description 'requires a valid CPF' end def failure_message 'does not require a valid CPF' end def matches?(subject) super(subject) disallows_value_of('123456') && allows_value_of('897.546.112-20') end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
validates_cpf-3.1.0 | lib/validates_cpf/require_a_valid_cpf_matcher.rb |
validates_cpf-3.0.0 | lib/validates_cpf/require_a_valid_cpf_matcher.rb |