Skip to content

Instantly share code, notes, and snippets.

@Bestra
Created April 29, 2014 17:28
Show Gist options
  • Save Bestra/11406814 to your computer and use it in GitHub Desktop.
Save Bestra/11406814 to your computer and use it in GitHub Desktop.
test 'Paper hasMany tasks (async)', ->
stop()
paperPromise = Ember.run =>
task1 = @store().createRecord 'task', type: 'MessageTask', title: 'A message', isMetaData: false
task2 = @store().createRecord 'task', type: 'TechCheckTask', title: 'some task',isMetaData: true
paper = @store().createRecord 'paper',
title: 'some really long title'
shortTitle: 'test short title'
paper.get('tasks').then (tasks) ->
tasks.pushObjects [task1, task2]
paper
paperPromise.then((paper) ->
deepEqual paper.get('tasks').mapBy('type'), ['MessageTask', 'TechCheckTask']
).then(start, start)
test 'allMetadata tasks filters tasks by isMetaData', ->
stop()
paperPromise = Ember.run =>
task1 = @store().createRecord 'task', type: 'MessageTask', title: 'A message', isMetaData: false
task2 = @store().createRecord 'task', type: 'TechCheckTask', title: 'some task',isMetaData: true
paper = @store().createRecord 'paper',
title: 'some really long title'
shortTitle: 'test short title'
paper.get('tasks').then (tasks) ->
tasks.pushObjects [task1, task2]
paper
paperPromise.then((paper) ->
deepEqual paper.get('allMetaDataTasks').mapBy('type'), ['TechCheckTask']
).then(start, start)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment