Skip to content

Commit

Permalink
Fixes acceptance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
twokul authored and stefanpenner committed Apr 13, 2014
1 parent 682df0e commit 90dd10c
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 44 deletions.
5 changes: 1 addition & 4 deletions lib/blueprint.js
Expand Up @@ -50,10 +50,7 @@ Blueprint.prototype.install = function(intoDir, templateVariables, dryRun) {
var actions = {
write: function(info) {
ui.write(' ' + chalk.green('create') + ' ' + info.displayPath + '\n');

if (!dryRun) {
return writeFile(info.render(), info.outputPath);
}
return writeFile(info.render(), info.outputPath);
},

skip: function(info) {
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/index.js
Expand Up @@ -17,7 +17,7 @@ require('../ext/promise');
module.exports = cli;
function cli(options) {
var ui = new UI({
inputStream: options.inputStream,
inputStream: options.inputStream,
outputStream: options.outputStream
});

Expand Down
1 change: 0 additions & 1 deletion lib/commands/init.js
Expand Up @@ -27,7 +27,6 @@ module.exports = new Command({
var npmInstall = environment.tasks.npmInstall;
var bowerInstall = environment.tasks.bowerInstall;


return installBlueprint.run(environment, { dryRun: options.dryRun })
.then(function() {
if (!options.dryRun) {
Expand Down
32 changes: 15 additions & 17 deletions tests/acceptance/init-slow.js
@@ -1,18 +1,17 @@
'use strict';

var ember = require('../helpers/ember');
var assert = require('assert');
var forEach = require('lodash-node/compat/collections/forEach');
var walkSync = require('walk-sync');
var ember = require('../helpers/ember');
var assert = require('assert');
var forEach = require('lodash-node/compat/collections/forEach');
var walkSync = require('walk-sync');
var Blueprint = require('../../lib/blueprint');
var path = require('path');
var tmp = require('../helpers/tmp');
var root = process.cwd();
var util = require('util');
var conf = require('../helpers/conf');

describe.skip('Acceptance: ember init', function() {
var path = require('path');
var tmp = require('../helpers/tmp');
var root = process.cwd();
var util = require('util');
var conf = require('../helpers/conf');

describe('Acceptance: ember init', function() {
before(function() {
conf.setup();
});
Expand All @@ -32,9 +31,8 @@ describe.skip('Acceptance: ember init', function() {

function confirmBlueprinted() {
var blueprintPath = path.join(root, 'blueprint');

var expected = walkSync(blueprintPath).sort();
var actual = walkSync('.').sort();
var expected = walkSync(blueprintPath).sort();
var actual = walkSync('.').sort();

forEach(Blueprint.renamedFiles, function(destFile, srcFile) {
expected[expected.indexOf(srcFile)] = destFile;
Expand All @@ -49,18 +47,18 @@ describe.skip('Acceptance: ember init', function() {
it('ember init,', function() {
return ember([
'init',
'--skip-npm-install'
'--dry-run'
]).then(confirmBlueprinted);
});

it('init an already init\'d folder', function() {
return ember([
'init',
'--skip-npm-install'
'--dry-run'
]).then(function() {
return ember([
'init',
'--skip-npm-install'
'--dry-run'
]).then(confirmBlueprinted);
});
});
Expand Down
30 changes: 15 additions & 15 deletions tests/acceptance/new-slow.js
@@ -1,18 +1,18 @@
'use strict';

var fs = require('fs-extra');
var ember = require('../helpers/ember');
var assert = require('assert');
var forEach = require('lodash-node/compat/collections/forEach');
var walkSync = require('walk-sync');
var fs = require('fs-extra');
var ember = require('../helpers/ember');
var assert = require('assert');
var forEach = require('lodash-node/compat/collections/forEach');
var walkSync = require('walk-sync');
var Blueprint = require('../../lib/blueprint');
var path = require('path');
var tmp = require('../helpers/tmp');
var root = process.cwd();
var util = require('util');
var conf = require('../helpers/conf');
var path = require('path');
var tmp = require('../helpers/tmp');
var root = process.cwd();
var util = require('util');
var conf = require('../helpers/conf');

describe.skip('Acceptance: ember new', function() {
describe('Acceptance: ember new', function() {
before(conf.setup);

after(conf.restore);
Expand Down Expand Up @@ -50,7 +50,7 @@ describe.skip('Acceptance: ember new', function() {
return ember([
'new',
'foo',
'--skip-npm-install'
'--dry-run'
]).then(confirmBlueprinted);
});

Expand All @@ -71,7 +71,7 @@ describe.skip('Acceptance: ember new', function() {
return ember([
'new',
'FooApp',
'--skip-npm-install'
'--dry-run'
]).then(function() {
assert(!fs.existsSync('FooApp'));

Expand All @@ -84,12 +84,12 @@ describe.skip('Acceptance: ember new', function() {
return ember([
'new',
'foo',
'--skip-npm-install'
'--dry-run'
]).then(function() {
return ember([
'new',
'foo',
'--skip-npm-install'
'--dry-run'
]).then(function() {
assert(!fs.existsSync('foo'));
});
Expand Down
25 changes: 19 additions & 6 deletions tests/helpers/ember.js
@@ -1,19 +1,32 @@
'use strict';

var Cli = require('../../lib/cli');

var rewire = require('rewire');
var Cli = rewire('../../lib/cli');
var baseArgs = ['node', 'path/to/cli'];
var MockUI = require('./mock-ui');

Cli.__set__('UI', function() {
this.outputStream = [];
this.inputStream = [];

this.write = function(data) {
this.outputStream.push(data);
};
});

module.exports = function ember(args) {
var argv;
var argv, cli;

if (args) {
argv = baseArgs.slice().concat(args);
} else {
argv = baseArgs;
}

var ui = module.exports.ui = new MockUI();
return Cli.run(argv, ui);
cli = new Cli({
inputStream: [],
outputStream: [],
cliArgs: args
});

return cli;
};

0 comments on commit 90dd10c

Please sign in to comment.