Skip to content

Commit

Permalink
Merge pull request #4159 from rjackson/add_ember_setupForTesting
Browse files Browse the repository at this point in the history
Add Ember.setupForTesting.
  • Loading branch information
machty committed Jan 21, 2014
2 parents 888bf56 + 1534927 commit 95e8503
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
18 changes: 18 additions & 0 deletions packages/ember-testing/lib/ext.js
Original file line number Diff line number Diff line change
@@ -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();
}
};
1 change: 1 addition & 0 deletions packages/ember-testing/lib/main.js
Original file line number Diff line number Diff line change
@@ -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');
Expand Down
7 changes: 1 addition & 6 deletions packages/ember-testing/lib/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,19 +351,14 @@ Ember.Application.reopen({
@method setupForTesting
*/
setupForTesting: function() {
Ember.testing = true;
Ember.setupForTesting();

this.testing = true;

this.Router.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;
}
Expand Down

0 comments on commit 95e8503

Please sign in to comment.