I have a strange problem, here’s how to reproduce.
Using ember-cli
0.44, create a new app, and generate a user
and address
model. They each belongsTo
each other.
Then, write a unit test for the address
that looks like this:
test('it has a user', function() {
var model = this.subject();
var store = this.store();
Ember.run(function() {
var user = store.createRecord('user');
model.set('user', user);
ok(true);
});
});
adding needs: ['model:user']
to the test. The test passes.
Now, type ember g acceptance-test index
. The unit tests break for the model, right on the model.set
line:
Assertion Failed: You can only add a ‘user’ record to this relationship
It doesn’t matter what’s in the acceptance test, just the fact that it exists is enough to break the unit tests.
Any ideas what’s going on?