Skip to content

Commit 1d6f3fb

Browse files
kevvabtford
authored andcommitted
fix(test): Add correct paths to generated files
1 parent 6df875c commit 1d6f3fb

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

test/test-appname-substitution.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ describe('Angular generator template mechanism', function () {
3636
it('should generate the same appName in every file', function (done) {
3737
var expectedAppName = folderName + 'App';
3838
var expected = [
39-
'app/scripts/app.js',
40-
'app/scripts/controllers/main.js',
39+
'app/app/main.js',
40+
'app/controller/main.js',
4141
'app/index.html',
42-
'test/spec/controllers/main.js'
42+
'test/spec/controller/main.js'
4343
];
4444
helpers.mockPrompt(angular, {
4545
bootstrap: true,
@@ -52,9 +52,9 @@ describe('Angular generator template mechanism', function () {
5252
helpers.assertFiles(expected);
5353

5454
// read JS Files
55-
var app_js = fs.readFileSync('app/scripts/app.js', 'utf8');
56-
var main_js = fs.readFileSync('app/scripts/controllers/main.js', 'utf8');
57-
var main_test_js = fs.readFileSync('test/spec/controllers/main.js', 'utf8');
55+
var app_js = fs.readFileSync('app/app/main.js', 'utf8');
56+
var main_js = fs.readFileSync('app/controller/main.js', 'utf8');
57+
var main_test_js = fs.readFileSync('test/spec/controller/main.js', 'utf8');
5858

5959
// Test JS Files
6060
var regex_js = new RegExp('module\\(\'' + expectedAppName + '\'');

test/test-file-creation.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ describe('Angular generator', function () {
5555
'Gruntfile.js',
5656
'package.json',
5757
['bower.json', /"name":\s+"temp"/],
58-
'app/scripts/app.js',
58+
'app/app/main.js',
5959
'app/index.html',
60-
'app/scripts/controllers/main.js',
61-
'test/spec/controllers/main.js'
60+
'app/controller/main.js',
61+
'test/spec/controller/main.js'
6262
];
6363
helpers.mockPrompt(angular, {
6464
bootstrap: true,
@@ -83,10 +83,10 @@ describe('Angular generator', function () {
8383
'Gruntfile.js',
8484
'package.json',
8585
['bower.json', /"name":\s+"temp"/],
86-
'app/scripts/app.coffee',
86+
'app/app/main.coffee',
8787
'app/index.html',
88-
'app/scripts/controllers/main.coffee',
89-
'test/spec/controllers/main.coffee'
88+
'app/controller/main.coffee',
89+
'test/spec/controller/main.coffee'
9090
];
9191
helpers.mockPrompt(angular, {
9292
bootstrap: true,
@@ -115,8 +115,8 @@ describe('Angular generator', function () {
115115
angular.run([], function () {
116116
angularCtrl.run([], function () {
117117
helpers.assertFiles([
118-
['app/scripts/controllers/foo.js', /controller\('FooCtrl'/],
119-
['test/spec/controllers/foo.js', /describe\('Controller: FooCtrl'/]
118+
['app/controller/foo.js', /controller\('FooCtrl'/],
119+
['test/spec/controller/foo.js', /describe\('Controller: FooCtrl'/]
120120
]);
121121
done();
122122
});

view/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ function Generator() {
2121
util.inherits(Generator, yeoman.generators.NamedBase);
2222

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

0 commit comments

Comments
 (0)