Skip to content

Commit

Permalink
blueprints/instance-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 e1dc61f commit 5822a13
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/instance-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: instance-initializer-test', function() {
Expand All @@ -26,6 +27,19 @@ describe('Blueprint: instance-initializer-test', function() {
});
});

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

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

describe('with ember-cli-mocha', function() {
beforeEach(function() {
modifyPackages([
Expand Down
29 changes: 29 additions & 0 deletions node-tests/fixtures/instance-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 | Instance 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 5822a13

Please sign in to comment.