ember.js - ember-cli test: Teardown failed: Cannot read property 'unchain' of undefined -
i'm trying write simple test ember-cli app:
import startapp 'wallet2/tests/helpers/start-app'; var app; module('integration - login', { setup: function() { app = startapp() }, teardown: function() { ember.run(app, "destroy"); } }); test('should ask me log in', function() { visit('/').then(function() { equal(find('h1#title').text(), 'please login'); equal(find('form').length, 1); }); });
the tests pass teardown fails with:
teardown failed on should ask me log in: cannot read property 'unchain' of undefined source: @ chainnodeprototype.unchain (http://localhost:4200/assets/vendor.js:17359:9) @ chainnodeprototype.remove (http://localhost:4200/assets/vendor.js:17331:8) @ ember.unwatchpath (http://localhost:4200/assets/vendor.js:17550:23) @ object.ember.unwatch (http://localhost:4200/assets/vendor.js:17619:5) @ object.ember.removeobserver (http://localhost:4200/assets/vendor.js:19031:9) @ null.<anonymous> (http://localhost:4200/assets/vendor.js:37793:13) @ object.sendevent (http://localhost:4200/assets/vendor.js:15748:14) @ ember.evented.ember.mixin.create.trigger (http://localhost:4200/assets/vendor.js:31468:11) @ superfunction [as _super] (http://localhost:4200/assets/vendor.js:20874:16) @ ember.coreview.ember.object.extend.trigger (http://localhost:4200/assets/vendor.js:35658:17)
i cannot find cause problem in backtrace.
here's start-app.js
var application = require('wallet2/app')['default']; var router = require('wallet2/router')['default']; export default function startapp(attrs) { var app; var attributes = ember.merge({ // useful test defaults rootelement: '#ember-testing', log_active_generation:false, log_view_lookups: false }, attrs); // can override; router.reopen({ location: 'none' }); ember.run(function(){ app = application.create(attributes); app.setupfortesting(); app.injecttesthelpers(); }); app.reset(); // shouldn't needed, want able "start app @ specific url" return app; }
any appreciated…
update (2014-07-07)here's routes/index.js called when visiting "/" ('m using ember-simple-auth)
import ember 'ember'; import authenticatedroutemixin 'simple-auth/mixins/authenticated-route-mixin'; export default ember.route.extend( authenticatedroutemixin, { redirect: function (params) { this.transitionto("users.show", this.get('session.user')); } });
the controllers/login.js
import ember 'ember'; import logincontrollermixin 'simple-auth/mixins/login-controller-mixin'; export default ember.controller.extend( logincontrollermixin, { authenticator: 'simple-auth-authenticator:devise' });
and login.hbs template:
<div class="row"> <div class="col-xs-12 col-sm-6 col-sm-offset-3"> <h1 id="title">please login</h1> <form {{action 'authenticate' on='submit'}} role="form"> <div class="form-group"> {{input id='identification' type="email" class="form-control" placeholder='email' value=identification}} </div> <div class="form-group"> {{input id='password' class="form-control" placeholder='password' type='password' value=password}} </div> <button class="btn btn-default" type="submit">login</button> </form> </div> <div class="col-xs-12 col-sm-6 col-sm-offset-3"> <p class="top"> {{#link-to "users.reset_password"}}did forget password?{{/link-to}} <p> </div> </div>
did try
ember.run(app, app.destroy);
instead of
ember.run(app, "destroy");
?
Comments
Post a Comment