This repository has been archived by the owner on Dec 10, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #239 from Turbo87/add-test-helpers
blueprints: Add `start/destroy-app` test helper files
- Loading branch information
Showing
2 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
blueprints/ember-cli-mocha/files/tests/helpers/destroy-app.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { run } from '@ember/runloop'; | ||
|
||
export default function destroyApp(application) { | ||
run(application, 'destroy'); | ||
} |
17 changes: 17 additions & 0 deletions
17
blueprints/ember-cli-mocha/files/tests/helpers/start-app.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import Application from '../../app'; | ||
import config from '../../config/environment'; | ||
import { merge } from '@ember/polyfills'; | ||
import { run } from '@ember/runloop'; | ||
|
||
export default function startApp(attrs) { | ||
let attributes = merge({}, config.APP); | ||
attributes.autoboot = true; | ||
attributes = merge(attributes, attrs); // use defaults, but you can override; | ||
|
||
return run(() => { | ||
let application = Application.create(attributes); | ||
application.setupForTesting(); | ||
application.injectTestHelpers(); | ||
return application; | ||
}); | ||
} |