Skip to content

Instantly share code, notes, and snippets.

@sly7-7
Created November 3, 2014 15:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sly7-7/2bf4ae9d8e5ffa5fe7f0 to your computer and use it in GitHub Desktop.
Save sly7-7/2bf4ae9d8e5ffa5fe7f0 to your computer and use it in GitHub Desktop.
failing test for 2447
test("When deleting a record that has a belongsTo relationship, the record is removed from the inverse but still has access to its own relationship - async", function () {
User.reopen({
observesBestFriend: Ember.observer('bestFriend', function () {
this.get('bestFriend');
})
});
var stanleysFriend = store.push('user', {id:2, name: "Stanley's friend"});
var stanley = store.push('user', {id:1, name: 'Stanley', bestFriend:2});
stanley.deleteRecord();
stanleysFriend.get('bestFriend').then(async(function(fetchedUser) {
equal(fetchedUser, null, 'Stanley got removed');
}));
stanley.get('bestFriend').then(async(function(fetchedUser) {
equal(fetchedUser, stanleysFriend, 'Stanleys friend did not get removed');
}));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment