I am using ember-cli-simple-auth
and ember-cli-simple-auth-devise
in an ember-cli
project.
I'm also customizing simple-auth's Session
via an initializer:
// app/initializers/custom-session.js
import Ember from 'ember';
import Session from 'simple-auth/session';
export default {
name: 'custom-session',
before: 'simple-auth',
initialize: function(container, application) {
Session.reopen({
setCurrentUser: function() {
var id = this.get('user_id'),
self = this;
if (!Ember.isEmpty(id)) {
return container.lookup('store:main').find('user', id)
.then(function(user) {
self.set('currentUser', user);
});
}
}.observes('user_id')
});
}
};
In a simple acceptance test (one that simply calls ok(1)
), I'm getting the following error
Error: Assertion Failed: calling set on destroyed object
Source:
at Adapter.extend.exception (localhost:4900/assets/vendor.js:57907:19)
at apply (http://localhost:4900/assets/vendor.js:21143:27)
at superWrapper [as exception] (localhost:4900/assets/vendor.js:20721:15)
at RSVP.onerrorDefault (localhost:4900/assets/vendor.js:59827:26)
at Object.__exports__.default.trigger (localhost:4900/assets/vendor.js:22673:13)
at Promise._onerror (localhost:4900/assets/vendor.js:23397:16)
at publishRejection (localhost:4900/assets/vendor.js:23804:17)
at http://localhost:4900/assets/vendor.js:29217:9
If I comment out the self.set('currentUser', user);
line, the error goes away.
What's the appropriate way to handle this? Is there a way to ignore this initializer in tests?
I also get this log message:
No authorizer factory was configured for Ember Simple Auth - specify one if backend requests need to be authorized.