diff --git a/packages/ember-testing/lib/ext.js b/packages/ember-testing/lib/ext.js new file mode 100644 index 00000000000..5e8651fa340 --- /dev/null +++ b/packages/ember-testing/lib/ext.js @@ -0,0 +1,18 @@ +/** + Sets Ember up for testing. This is useful to perform + basic setup steps in order to unit test. + + Use `App.setupForTesting` to perform integration tests (full + application testing). + + @method setupForTesting + @namespace Ember +*/ +Ember.setupForTesting = function() { + Ember.testing = true; + + // if adapter is not manually set default to QUnit + if (!Ember.Test.adapter) { + Ember.Test.adapter = Ember.Test.QUnitAdapter.create(); + } +}; diff --git a/packages/ember-testing/lib/main.js b/packages/ember-testing/lib/main.js index e5eb8cef4b3..b3ac3c1884a 100644 --- a/packages/ember-testing/lib/main.js +++ b/packages/ember-testing/lib/main.js @@ -1,5 +1,6 @@ require('ember-application'); require('ember-routing'); +require('ember-testing/ext'); require('ember-testing/test'); require('ember-testing/initializers'); require('ember-testing/support'); diff --git a/packages/ember-testing/lib/test.js b/packages/ember-testing/lib/test.js index dce5bd93424..07101187343 100644 --- a/packages/ember-testing/lib/test.js +++ b/packages/ember-testing/lib/test.js @@ -351,7 +351,7 @@ Ember.Application.reopen({ @method setupForTesting */ setupForTesting: function() { - Ember.testing = true; + Ember.setupForTesting(); this.testing = true; @@ -359,11 +359,6 @@ Ember.Application.reopen({ location: 'none' }); - // if adapter is not manually set default to QUnit - if (!Ember.Test.adapter) { - Ember.Test.adapter = Ember.Test.QUnitAdapter.create(); - } - if (Ember.FEATURES.isEnabled('ember-testing-simple-setup')){ this.testingSetup = true; }