diff --git a/tests/unit/validate-test.js b/tests/unit/validate-test.js index 2d38286f..7bf6bc99 100644 --- a/tests/unit/validate-test.js +++ b/tests/unit/validate-test.js @@ -14,9 +14,11 @@ const { Object: EmberObject, ObjectController, get, + getOwner, isEmpty, run, - set + set, + setOwner } = Ember; moduleFor('object:user', 'Validate test', { @@ -81,6 +83,19 @@ test('runs all validations', function(assert) { return promise; }); +test('it can be mixed into an Ember Object', function(assert) { + let defaults = { + validations: { + soul: { presence: true } + } + }; + + setOwner(defaults, getOwner(this)); + let Being = EmberObject.extend(EmberValidations, defaults); + let being = Being.create({ soul: null }); + assert.equal(get(being, 'isValid'), false); +}); + if (ObjectController) { test('can be mixed into an controller', function(assert) { let Controller;