lib/validates_cpf.rb in validates_cpf-0.2.2 vs lib/validates_cpf.rb in validates_cpf-1.0.0
- old
+ new
@@ -1,6 +1,9 @@
-require "active_model"
require "validates_cpf/cpf"
+
+#Rspec Matchers
+require "validates_cpf/shoulda-matchers/require_a_valid_cpf_matcher" if defined?(::Shoulda)
+require "validates_cpf/remarkable/require_a_valid_cpf_matcher" if defined?(::Remarkable)
class CpfValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
record.errors[attribute] << I18n.t("errors.messages.invalid") unless CPF.new(value).valid?
end
\ No newline at end of file