Sha256: 9ab19652faa8e16ba381c1e302a857382d15981289af3ea88fb76599d140e2f3

Contents?: true

Size: 1.27 KB

Versions: 28

Compression:

Stored size: 1.27 KB

Contents

var root;

root = typeof exports !== "undefined" && exports !== null ? exports : window;

require('indemma/lib/record/validatable');

describe('model ( validates_associated: ... )', function() {
  return describe('basic usage', function() {
    var address, model, person;

    model = root.model;
    person = address = null;
    beforeEach(function() {
      address = model.call({
        resource: 'address',
        street: String,
        validates_presence_of: 'street'
      });
      return person = model.call({
        resource: 'person',
        has_one: 'address',
        validates_associated: 'address'
      });
    });
    afterEach(function() {
      person.validators.length = 0;
      return address.validators.length = 0;
    });
    return describe('.validate()', function() {
      return it('should add error to record when fields does not match', function() {
        var arthur;

        arthur = person({});
        arthur.build_address({
          street: null
        });
        arthur.valid;
        arthur.errors.messages.should.have.deep.property('address', 'O registro associado address não é válido.');
        return arthur.address.errors.messages.should.have.deep.property('street', 'O campo street não pode ficar em branco.');
      });
    });
  });
});

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
ende-0.4.25 vendor/components/indefinido-indemma/spec/record/validations/associated_spec.js
ende-0.4.24 vendor/components/indefinido-indemma/spec/record/validations/associated_spec.js
ende-0.4.23 vendor/components/indefinido-indemma/spec/record/validations/associated_spec.js
ende-0.5.1 components/indefinido/indemma/master/spec/record/validations/associated_spec.js
ende-0.4.22 vendor/components/indefinido-indemma/spec/record/validations/associated_spec.js
ende-0.4.21 vendor/components/indefinido-indemma/spec/record/validations/associated_spec.js
ende-0.5.0 vendor/components/indefinido-indemma/spec/record/validations/associated_spec.js
ende-0.4.20 vendor/components/indefinido-indemma/spec/record/validations/associated_spec.js
ende-0.4.19 vendor/components/indefinido-indemma/spec/record/validations/associated_spec.js
ende-0.4.18 vendor/components/indefinido-indemma/spec/record/validations/associated_spec.js
ende-0.4.17 vendor/components/indefinido-indemma/spec/record/validations/associated_spec.js
ende-0.4.16 vendor/components/indefinido-indemma/spec/record/validations/associated_spec.js
ende-0.4.15 vendor/components/indefinido-indemma/spec/record/validations/associated_spec.js
ende-0.4.14 vendor/components/indefinido-indemma/spec/record/validations/associated_spec.js
ende-0.4.13 vendor/components/indefinido-indemma/spec/record/validations/associated_spec.js
ende-0.4.12 vendor/components/indefinido-indemma/spec/record/validations/associated_spec.js
ende-0.4.11 vendor/components/indefinido-indemma/spec/record/validations/associated_spec.js
ende-0.4.10 vendor/components/indefinido-indemma/spec/record/validations/associated_spec.js
ende-0.4.9 vendor/components/indefinido-indemma/spec/record/validations/associated_spec.js
ende-0.4.8 vendor/components/indefinido-indemma/spec/record/validations/associated_spec.js