Sha256: 7f764d6afba753f2bc836747aab3c8146b6b90b6f95f2244b082e7bd196c7198

Contents?: true

Size: 747 Bytes

Versions: 2

Compression:

Stored size: 747 Bytes

Contents

root = exports ? window

require 'indemma/lib/record/validatable.js'

describe 'model #() validates_cpf_format',  ->

  describe 'basic usage', ->
    model  = root.model

    beforeEach ->
      @person = model.call
        resource : 'person'
        cpf      : String
        validates_cpf_format: 'cpf'

    afterEach ->
      # Clear validators from resource
      @person.validators.length = 0

    describe '#validate', ->

      it 'should add error to record when fields is in invalid format', ->
        arthur = @person cpf: '871.95FRANGO-00'
        arthur.valid

        # TODO figure out why the heck the validators aren't being reset
        arthur.errors.messages.should.have.deep.property 'cpf', "O campo cpf não está válido."

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ende-0.5.22 components/indefinido/indemma/master/src/spec/record/validations/cpf_spec.coffee
ende-0.5.21 components/indefinido/indemma/master/src/spec/record/validations/cpf_spec.coffee