Skip to content

Commit

Permalink
Fix yeoman-generator test after last environment update
Browse files Browse the repository at this point in the history
  • Loading branch information
SBoudrias committed Jan 22, 2015
1 parent 13142a3 commit a19cb28
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
11 changes: 7 additions & 4 deletions test/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,12 @@ describe('generators.Base', function () {
this.env.registerStub(Dummy, 'hook1:ember');
this.env.registerStub(Dummy, 'hook2:ember:all');
this.env.registerStub(Dummy, 'hook3');
this.env.registerStub(function () {
this.write(path.join(tmpdir, 'app/scripts/models/application-model.js'), '// ...');
}, 'hook4');

this.env.registerStub(generators.Base.extend({
writing: function () {
this.write(path.join(tmpdir, 'app/scripts/models/application-model.js'), '// ...');
}
}), 'hook4');

this.dummy = new Dummy(['bar', 'baz', 'bom'], {
foo: false,
Expand Down Expand Up @@ -70,7 +73,7 @@ describe('generators.Base', function () {
});

it('use the environment options', function () {
this.env.registerStub(function () {}, 'ember:model');
this.env.registerStub(generators.Base.extend(), 'ember:model');
var generator = this.env.create('ember:model', {
options: {
'test-framework': 'jasmine'
Expand Down
8 changes: 4 additions & 4 deletions test/fixtures/custom-generator-simple/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

var generators = require('../../..');

// Example of a simple generator.
//
Expand All @@ -13,9 +13,9 @@
// stuff, extend from Generator.Base and defines your generator steps
// in several methods.

module.exports = function(args, options) {
console.log('Executing generator with', args, options);
};
module.exports = generators.Base.extend({
exec: function () {}
});

module.exports.name = 'You can name your generator';
module.exports.description = 'And add a custom description by adding a `description` property to your function.';
Expand Down
12 changes: 7 additions & 5 deletions test/run-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@ var assert = require('assert');
var sinon = require('sinon');
var inquirer = require('inquirer');
var RunContext = require('../lib/test/run-context');
var yo = require('../');
var generators = require('..');
var tmpdir = path.join(os.tmpdir(), 'yeoman-run-context');
var helpers = yo.test;
var helpers = generators.test;

describe('RunContext', function () {
beforeEach(function () {
process.chdir(__dirname);
this.defaultInput = inquirer.prompts.input;
var Dummy = this.Dummy = helpers.createDummyGenerator();

this.execSpy = sinon.spy();
Dummy.prototype.exec = this.execSpy;
this.ctx = new RunContext(Dummy);
this.Dummy = generators.Base.extend({
exec: this.execSpy
});
this.ctx = new RunContext(this.Dummy);
});

afterEach(function (done) {
Expand Down

0 comments on commit a19cb28

Please sign in to comment.