Ember testing helper function that uses Ember.RSVP.Promise


#1

Hi!

I am having issue with Ember.RSVP.Promise in Ember testing. I made a helper function that pushes payload to store and then returns the object.

@getUser = ->
  new Ember.RSVP.Promise (resolve) ->
    Ember.run ->
      getStore().pushPayload "user", users: [id: 1, name: "User1" ]
      getStore().find("user", 1).then (user) -> resolve(user) 

module "Model - User"

test "works with run", ->
  Ember.run -> getUser().then (user) ->
      equal user.get("name"), "User1"

test "doesnt work without run", ->
  getUser().then (user) ->
      equal user.get("name"), "User1"

Here is jsbin http://emberjs.jsbin.com/semuligo/3/edit