Skip to content

Instantly share code, notes, and snippets.

@amk221
Last active November 23, 2015 13:52
Show Gist options
  • Save amk221/9fc8946d269a9da4b187 to your computer and use it in GitHub Desktop.
Save amk221/9fc8946d269a9da4b187 to your computer and use it in GitHub Desktop.
module('user utils');
test('birthday string', function(assert) {
assert.expect(2);
let fred = EmberObject.create({
name: 'Fred',
dob: moment('2015-10-23')
});
let john = EmberObject.create({
name: 'John',
dob: moment('2014-01-19')
})
let MyObject = EmberObject.extend({
user: null,
str: birthDateStrFor('user')
});
let myObject = MyObject.create({ fred });
assert.equal(obj.get('str'), "Fred's birthday is on 23/10/2015",
'computes a birthday string');
myObject.set('user', 'john');
assert.equal(obj.get('str'), "John's birthday is on 19/01/2014",
'string is recomputed when the dependant user changes');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment