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

Commit

Permalink
Utilize new destroy-app.js when present.
Browse files Browse the repository at this point in the history
1.13.9 of ember-cli will have a destroy-app.js similar to start-app.js. See [this PR](https://github.com/ember-cli/ember-cli/pull/4772/files).
This patch uses that file if it's present.
  • Loading branch information
blimmer committed Sep 21, 2015
1 parent e21658c commit d07445b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {
afterEach
} from 'mocha';
import { expect } from 'chai';
import Ember from 'ember';
import startApp from '../helpers/start-app';
<% if (destroyAppExists) { %>import destroyApp from '../helpers/destroy-app';<% } else { %>import Ember from 'ember';<% } %>

describe('Acceptance: <%= classifiedModuleName %>', function() {
var application;
Expand All @@ -17,7 +17,7 @@ describe('Acceptance: <%= classifiedModuleName %>', function() {
});

afterEach(function() {
Ember.run(application, 'destroy');
<% if (destroyAppExists) { %>destroyApp(application);<% } else { %>Ember.run(application, 'destroy');<% } %>
});

it('can visit /<%= dasherizedModuleName %>', function() {
Expand Down
14 changes: 13 additions & 1 deletion blueprints/acceptance-test/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
var existsSync = require('exists-sync');
var path = require('path');

module.exports = {
description: 'Generates an acceptance test for a feature.'
description: 'Generates an acceptance test for a feature.',

locals: function() {
var destroyAppExists =
existsSync(path.join(this.project.root, '/tests/helpers/destroy-app.js'));

return {
destroyAppExists: destroyAppExists
};
}
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
},
"homepage": "https://github.com/switchfly/ember-cli-mocha",
"dependencies": {
"broccoli-jshint": "^0.5.6"
"broccoli-jshint": "^0.5.6",
"exists-sync": "0.0.3"
},
"bundledDependencies": [ ]
}

0 comments on commit d07445b

Please sign in to comment.