Skip to content
This repository has been archived by the owner on Dec 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #239 from Turbo87/add-test-helpers
Browse files Browse the repository at this point in the history
blueprints: Add `start/destroy-app` test helper files
  • Loading branch information
Turbo87 authored Jan 28, 2018
2 parents 42917b2 + 84c7075 commit b5cec06
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions blueprints/ember-cli-mocha/files/tests/helpers/destroy-app.js
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 blueprints/ember-cli-mocha/files/tests/helpers/start-app.js
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;
});
}

0 comments on commit b5cec06

Please sign in to comment.