Class: Shoulda::Matchers::ActiveModel::RequireAValidCpfMatcher
- Inherits:
-
ValidationMatcher
- Object
- ValidationMatcher
- Shoulda::Matchers::ActiveModel::RequireAValidCpfMatcher
- Defined in:
- lib/validates_cpf/shoulda-matchers/require_a_valid_cpf_matcher.rb
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(attribute) ⇒ RequireAValidCpfMatcher
constructor
A new instance of RequireAValidCpfMatcher.
- #matches?(subject) ⇒ Boolean
Constructor Details
#initialize(attribute) ⇒ RequireAValidCpfMatcher
Returns a new instance of RequireAValidCpfMatcher.
11 12 13 |
# File 'lib/validates_cpf/shoulda-matchers/require_a_valid_cpf_matcher.rb', line 11 def initialize(attribute) @attribute = attribute end |
Instance Method Details
#description ⇒ Object
15 16 17 |
# File 'lib/validates_cpf/shoulda-matchers/require_a_valid_cpf_matcher.rb', line 15 def description "require a valid CPF number" end |
#matches?(subject) ⇒ Boolean
19 20 21 22 23 |
# File 'lib/validates_cpf/shoulda-matchers/require_a_valid_cpf_matcher.rb', line 19 def matches?(subject) super(subject) disallows_invalid_value and allows_valid_value end |