Skip to content

Commit

Permalink
blueprints/initializer-test: Add RFC232 variants
Browse files Browse the repository at this point in the history
  • Loading branch information
snewcomer committed Dec 8, 2017
1 parent 5e8b75c commit 4fc1370
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import Application from '@ember/application';
import { run } from '@ember/runloop';

import { initialize } from '<%= dasherizedModulePrefix %>/initializers/<%= dasherizedModuleName %>';
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import destroyApp from '../../helpers/destroy-app';

module('<%= friendlyTestName %>', function(hooks) {
setupTest(hooks);

hooks.beforeEach(function() {
run(() => {
this.application = Application.create();
this.application.deferReadiness();
});
});
hooks.afterEach(function() {
destroyApp(this.application);
});

// Replace this with your real tests.
test('it works', function(assert) {
initialize(this.application);

// you would normally confirm the results of the initializer here
assert.ok(true);
});
});
14 changes: 14 additions & 0 deletions node-tests/blueprints/initializer-test-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const modifyPackages = blueprintHelpers.modifyPackages;
const chai = require('ember-cli-blueprint-test-helpers/chai');
const expect = chai.expect;

const generateFakePackageManifest = require('../helpers/generate-fake-package-manifest');
const fixture = require('../helpers/fixture');

describe('Blueprint: initializer-test', function() {
Expand All @@ -26,6 +27,19 @@ describe('Blueprint: initializer-test', function() {
});
});

describe('with ember-cli-qunit@4.1.1', function() {
beforeEach(function() {
generateFakePackageManifest('ember-cli-qunit', '4.1.1');
});

it('initializer-test foo', function() {
return emberGenerateDestroy(['initializer-test', 'foo'], _file => {
expect(_file('tests/unit/initializers/foo-test.js'))
.to.equal(fixture('initializer-test/rfc232.js'));
});
});
});

describe('with ember-cli-mocha', function() {
beforeEach(function() {
modifyPackages([
Expand Down
29 changes: 29 additions & 0 deletions node-tests/fixtures/initializer-test/rfc232.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import Application from '@ember/application';
import { run } from '@ember/runloop';

import { initialize } from 'my-app/initializers/foo';
import { module, test } from 'qunit';
import { setupTest } from 'ember-qunit';
import destroyApp from '../../helpers/destroy-app';

module('Unit | Initializer | foo', function(hooks) {
setupTest(hooks);

hooks.beforeEach(function() {
run(() => {
this.application = Application.create();
this.application.deferReadiness();
});
});
hooks.afterEach(function() {
destroyApp(this.application);
});

// Replace this with your real tests.
test('it works', function(assert) {
initialize(this.application);

// you would normally confirm the results of the initializer here
assert.ok(true);
});
});

0 comments on commit 4fc1370

Please sign in to comment.