Sha256: b5ecfe4c700c473ca5dfb231643225ea7c87f6c07edf2be0103284f793b842ac
Contents?: true
Size: 808 Bytes
Versions: 2
Compression:
Stored size: 808 Bytes
Contents
require 'remarkable/active_record' module Remarkable module ActiveRecord module Matchers class ValidateAsCpfMatcher < Remarkable::ActiveRecord::Base arguments :cpf collection_assertions :cpf_valid?, :allow_nil?, :formatted_number? protected def cpf_valid? @subject.cpf = '123456' @subject.valid?.errors[:cpf].should == ['is invalid'] end def allow_nil? @subject.cpf = nil @subject.valid?.errors[:cpf].should == [] end def formatted_number? @subject.cpf = '55658208394' @subject.valid?.cpf.should == '556.582.083-94' end end def validate_as_cpf(*args, &block) ValidateAsCpfMatcher.new(*args, &block).spec(self) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
validates_cpf-0.2.2 | lib/validates_cpf/remarkable/validate_as_cpf_matcher.rb |
validates_cpf-0.2.1 | lib/validates_cpf/remarkable/validate_as_cpf_matcher.rb |