Skip to content
This repository has been archived by the owner on Jan 31, 2019. It is now read-only.

Commit

Permalink
Test case for use with Ember.Object
Browse files Browse the repository at this point in the history
  • Loading branch information
briangonzalez committed Sep 26, 2016
1 parent 4502593 commit 8c50335
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion tests/unit/validate-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ const {
Object: EmberObject,
ObjectController,
get,
getOwner,
isEmpty,
run,
set
set,
setOwner
} = Ember;

moduleFor('object:user', 'Validate test', {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 8c50335

Please sign in to comment.