Sha256: f46fa8679540ddd484327bae9617cefc84c72fd1fe8c820298101215340639f2
Contents?: true
Size: 572 Bytes
Versions: 2
Compression:
Stored size: 572 Bytes
Contents
# frozen_string_literal: true require 'shoulda-matchers' require 'active_support/core_ext/array/wrap' module Shoulda module Matchers module ActiveModel def require_a_valid_cnpj(attr = :cnpj) RequireAValidCnpjMatcher.new(attr) end class RequireAValidCnpjMatcher < ValidationMatcher def description 'require a valid CNPJ number' end def matches?(subject) @subject = subject disallows_value_of('123456') && allows_value_of('51.114.450/0001-46') end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
validates_cnpj-3.1.0 | lib/validates_cnpj/require_a_valid_cnpj_matcher.rb |
validates_cnpj-3.0.0 | lib/validates_cnpj/require_a_valid_cnpj_matcher.rb |