Skip to content
This repository has been archived by the owner on Mar 26, 2018. It is now read-only.

Commit

Permalink
fix(test): Add correct paths to generated files
Browse files Browse the repository at this point in the history
  • Loading branch information
kevva authored and btford committed Aug 1, 2013
1 parent 6df875c commit 1d6f3fb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
12 changes: 6 additions & 6 deletions test/test-appname-substitution.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ describe('Angular generator template mechanism', function () {
it('should generate the same appName in every file', function (done) {
var expectedAppName = folderName + 'App';
var expected = [
'app/scripts/app.js',
'app/scripts/controllers/main.js',
'app/app/main.js',
'app/controller/main.js',

This comment has been minimized.

Copy link
@eddiemonge

eddiemonge Aug 2, 2013

Member

Are these changes intentional?
should the new paths really be
app/app/main.js
app/controllers.js
instead of being in the app/scripts directory?

This comment has been minimized.

Copy link
@kevva

kevva Aug 3, 2013

Author Member

This comment has been minimized.

Copy link
@pstinghua

pstinghua Aug 4, 2013

+1

'app/index.html',
'test/spec/controllers/main.js'
'test/spec/controller/main.js'
];
helpers.mockPrompt(angular, {
bootstrap: true,
Expand All @@ -52,9 +52,9 @@ describe('Angular generator template mechanism', function () {
helpers.assertFiles(expected);

// read JS Files
var app_js = fs.readFileSync('app/scripts/app.js', 'utf8');
var main_js = fs.readFileSync('app/scripts/controllers/main.js', 'utf8');
var main_test_js = fs.readFileSync('test/spec/controllers/main.js', 'utf8');
var app_js = fs.readFileSync('app/app/main.js', 'utf8');
var main_js = fs.readFileSync('app/controller/main.js', 'utf8');
var main_test_js = fs.readFileSync('test/spec/controller/main.js', 'utf8');

// Test JS Files
var regex_js = new RegExp('module\\(\'' + expectedAppName + '\'');
Expand Down
16 changes: 8 additions & 8 deletions test/test-file-creation.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ describe('Angular generator', function () {
'Gruntfile.js',
'package.json',
['bower.json', /"name":\s+"temp"/],
'app/scripts/app.js',
'app/app/main.js',
'app/index.html',
'app/scripts/controllers/main.js',
'test/spec/controllers/main.js'
'app/controller/main.js',
'test/spec/controller/main.js'
];
helpers.mockPrompt(angular, {
bootstrap: true,
Expand All @@ -83,10 +83,10 @@ describe('Angular generator', function () {
'Gruntfile.js',
'package.json',
['bower.json', /"name":\s+"temp"/],
'app/scripts/app.coffee',
'app/app/main.coffee',
'app/index.html',
'app/scripts/controllers/main.coffee',
'test/spec/controllers/main.coffee'
'app/controller/main.coffee',
'test/spec/controller/main.coffee'
];
helpers.mockPrompt(angular, {
bootstrap: true,
Expand Down Expand Up @@ -115,8 +115,8 @@ describe('Angular generator', function () {
angular.run([], function () {
angularCtrl.run([], function () {
helpers.assertFiles([
['app/scripts/controllers/foo.js', /controller\('FooCtrl'/],
['test/spec/controllers/foo.js', /describe\('Controller: FooCtrl'/]
['app/controller/foo.js', /controller\('FooCtrl'/],
['test/spec/controller/foo.js', /describe\('Controller: FooCtrl'/]
]);
done();
});
Expand Down
4 changes: 2 additions & 2 deletions view/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ function Generator() {
util.inherits(Generator, yeoman.generators.NamedBase);

Generator.prototype.createViewFiles = function createViewFiles() {
var targetPath = this.name;
var targetPath = this.name;
if (this.name.indexOf('/') === -1) {
targetPath = 'views/' + targetPath;
}
this.template('common/view.html', path.join(this.env.options.appPath, this.name + '.html'));
this.template('common/view.html', path.join(this.env.options.appPath, targetPath + '.html'));
};

0 comments on commit 1d6f3fb

Please sign in to comment.