From 1d6f3fbfcc315316a44b468418918afaad871f57 Mon Sep 17 00:00:00 2001 From: Kevin Martensson Date: Thu, 1 Aug 2013 03:05:16 +0200 Subject: [PATCH] fix(test): Add correct paths to generated files --- test/test-appname-substitution.js | 12 ++++++------ test/test-file-creation.js | 16 ++++++++-------- view/index.js | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/test/test-appname-substitution.js b/test/test-appname-substitution.js index 925bd2266..c3ce86dd6 100644 --- a/test/test-appname-substitution.js +++ b/test/test-appname-substitution.js @@ -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', 'app/index.html', - 'test/spec/controllers/main.js' + 'test/spec/controller/main.js' ]; helpers.mockPrompt(angular, { bootstrap: true, @@ -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 + '\''); diff --git a/test/test-file-creation.js b/test/test-file-creation.js index 9acc0543b..ccf09ddcb 100644 --- a/test/test-file-creation.js +++ b/test/test-file-creation.js @@ -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, @@ -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, @@ -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(); }); diff --git a/view/index.js b/view/index.js index 7c216bb00..88267624f 100644 --- a/view/index.js +++ b/view/index.js @@ -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')); };