I'm getting an error when using visit in a test :
TypeError: Object # has no method 'getHandler'
module("visit", {
setup: function() {
Ember.run(App, App.advanceReadiness);
},
teardown: function() {
App.reset();
}
});
test("visit works", function () {
expect(2);
// this gets executed
equal(1, 1);
return visit("/").then(function() {
// this doesn't
equal(1, 1);
});
});
The resulting error trace is :
Died on test #2 at eval (eval at <anonymous> (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066)), <anonymous>:10:1)
at eval (native)
at eval (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066), <anonymous>:2:14066)
at Function.p.extend.globalEval (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066), <anonymous>:2:14077)
at p.ajaxSetup.converters.text script (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066), <anonymous>:2:83767)
at cC (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066), <anonymous>:2:5874)
at y (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066), <anonymous>:2:79888)
at d (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066), <anonymous>:2:85578): Object #<Object> has no method 'getHandler'
Source:
TypeError: Object #<Object> has no method 'getHandler'
at generateHandlerInfos (eval at <anonymous> (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066)), <anonymous>:25824:31)
at performTransition (eval at <anonymous> (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066)), <anonymous>:25758:30)
at createURLTransition (eval at <anonymous> (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066)), <anonymous>:25501:18)
at doTransition (eval at <anonymous> (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066)), <anonymous>:26067:20)
at Object.Router.handleURL (eval at <anonymous> (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066)), <anonymous>:25213:20)
at Ember.Router.Ember.Object.extend._doTransition (eval at <anonymous> (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066)), <anonymous>:26491:53)
at Ember.Router.Ember.Object.extend.handleURL (eval at <anonymous> (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066)), <anonymous>:26331:21)
at Ember.Application.Ember.Namespace.extend.handleURL (eval at <anonymous> (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066)), <anonymous>:30240:16)
at Object.Backburner.run (eval at <anonymous> (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066)), <anonymous>:4862:30)
at Object.Ember.run (eval at <anonymous> (eval at <anonymous> (http://127.0.0.1:3000/javascripts/libs/jquery/jquery-1.8.0.min.js:2:14066)), <anonymous>:5200:30)
I've made sure Ember is loaded before the tests are run as suggested in this answer. QUnit is also working properly as a basic test on fixtures is working.
I've now spent hours on this issue and I don't have any clue why this is happening.
Edit (following Daniel's comment)
The route is pretty simple and looks like that :
App.IndexRoute = Ember.Route.extend({
redirect: function(){
this.transitionTo('about');
}
});
App.Router.map(function(){
this.route('about');
});