diff --git a/packages/ember-application/lib/system/application.js b/packages/ember-application/lib/system/application.js index 8336131c868..1abdcb6bbaa 100644 --- a/packages/ember-application/lib/system/application.js +++ b/packages/ember-application/lib/system/application.js @@ -291,11 +291,11 @@ var Application = Namespace.extend(DeferredMixin, { // This is to ensure that someone reopening `App.Router` does not // tamper with the default `Ember.Router`. // 2.0TODO: Can we move this into a globals-mode-only library? - this.Router = Router.extend(); + this.Router = (this.Router || Router).extend(); this.waitForDOMReady(this.buildDefaultInstance()); } } else { - this.Router = Router.extend(); + this.Router = (this.Router || Router).extend(); this.waitForDOMReady(this.buildDefaultInstance()); } }, diff --git a/packages/ember-application/tests/system/application_test.js b/packages/ember-application/tests/system/application_test.js index 90639dbf80d..f8ba036533d 100644 --- a/packages/ember-application/tests/system/application_test.js +++ b/packages/ember-application/tests/system/application_test.js @@ -281,6 +281,18 @@ QUnit.test("can resolve custom router", function() { ok(app.__container__.lookup('router:main') instanceof CustomRouter, 'application resolved the correct router'); }); +QUnit.test("can specify custom router", function() { + var CustomRouter = Router.extend(); + + app = run(function() { + return Application.create({ + Router: CustomRouter + }); + }); + + ok(app.__container__.lookup('router:main') instanceof CustomRouter, 'application resolved the correct router'); +}); + QUnit.test("throws helpful error if `app.then` is used", function() { run(function() { app = Application.create({