Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading to v0.4.12 causes error: calling set on destroyed object #233

Closed
xcskier56 opened this issue Jul 13, 2016 · 1 comment
Closed

Comments

@xcskier56
Copy link

xcskier56 commented Jul 13, 2016

Upgrading beyond v0.4.12 has started to cause some of my model tests to hang and fail when I create another record in the test. I've tested this in almost all of the version beyond 0.4.12 up to the latest release and it is still happening.

I've created a twiddle that demonstrates the error: https://ember-twiddle.com/70b2098e178cf10b87969ac4b28a5ba3?openFiles=tests.unit.models.user-test.js%2C

Basically, with a user, and relationship model, I create the relationship in the test and test that the two different directions on the relationship are working properly. This is a more simplistic test than my actual one, but the issue is the same.

I'm using Ember 1.13.13, and Ember Data 1.13.15. This is happening with all of my other model tests that use a similar pattern.

I setup the test based on the ember-data test here:

models/user.js

import DS from 'ember-data'

export default DS.Model.extend({
  firstName: DS.attr('string'),
  inboundRelationships: DS.hasMany('relationship', {
    async: true, 
    inverse: 'followed'
  }),
  outboundRelationships: DS.hasMany('relationship', {
    async: true,
    inverse: 'follower'
  })                  
});

models/relationship.js

import DS from 'ember-data'

export default DS.Model.extend({
  confirmed:  DS.attr('boolean'),
  followed: DS.belongsTo('user', {
    async: true,
    inverse: 'inboundRelationships'
  }),
  follower: DS.belongsTo('user', {
    async: true,
    inverse: 'outboundRelationships'
  })                  
});

test:

import { moduleForModel, test } from 'ember-qunit';

moduleForModel('user', {
  // Specify the other units that are required for this test.
  needs: ['model:relationship']
});

test('followers', function(assert) {
  const store = this.store();
  const user = this.subject();

  let relationship, user2;

  Ember.run( function() {
    user2 = store.createRecord('user');
    relationship = store.createRecord('relationship',{
      followed: user,
      follower: user2,
      confirmed: true
    });
  });

  assert.equal(user.get('inboundRelationships.length'), 1)
  assert.equal(user2.get('outboundRelationships.length'), 1)
  // error happens after test.
})
@rwjblue
Copy link
Member

rwjblue commented Oct 17, 2017

Sorry for letting this linger so long, this issue is quite out of date and likely the underlying problem has been fixed. Initial implementation of the new ember-qunit API (from emberjs/rfcs#232) has landed and will be included in 3.0.0 release soon.

Closing as I do not believe that this issue can be addressed in the current ember-qunit@2 API.

@rwjblue rwjblue closed this as completed Oct 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants