Skip to content

Instantly share code, notes, and snippets.

@bradleypriest
Last active December 27, 2015 15:49
Show Gist options
  • Save bradleypriest/7350587 to your computer and use it in GitHub Desktop.
Save bradleypriest/7350587 to your computer and use it in GitHub Desktop.
module "User",
setup: ->
store = App.__container__.lookup("store:main")
@user = Ember.run ->
store.createRecord "user",
firstName: 'Bart'
lastName: 'Simpson'
roles: 'user,admin'
test "has a first name", ->
equal(@user.get('firstName'), 'Bart')
test "no first name", ->
Ember.run =>
@user.set('firstName', null)
equal(@user.get('fullName'), 'Simpson')
test "no last name", ->
Ember.run =>
@user.set('lastName', null)
equal(@user.get('fullName'), 'Bart')
test "no name", ->
Ember.run =>
@user.set('firstName', null)
@user.set('lastName', null)
equal(@user.get('fullName'), null)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment