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

Commit

Permalink
fix(app): services use classified names
Browse files Browse the repository at this point in the history
Fix app tests that used cameled service names instead of classified
names.

Closes #484
  • Loading branch information
eddiemonge committed Dec 6, 2013
1 parent a358c1a commit 56a71a8
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 22 deletions.
5 changes: 5 additions & 0 deletions script-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ Generator.prototype.addScriptToIndex = function (script) {
};

Generator.prototype.generateSourceAndTest = function (appTemplate, testTemplate, targetDirectory, skipAdd) {
// Services use classified names
if (this.generatorName.toLowerCase() === 'service') {
this.cameledName = this.classedName;
}

this.appTemplate(appTemplate, path.join('scripts', targetDirectory, this.name));
this.testTemplate(testTemplate, path.join(targetDirectory, this.name));
if (!skipAdd) {
Expand Down
10 changes: 5 additions & 5 deletions templates/coffeescript-min/spec/service.coffee
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
'use strict'

describe 'Service: <%= classedName %>', () ->
describe 'Service: <%= cameledName %>', () ->

# load the service's module
beforeEach module '<%= scriptAppName %>'

# instantiate service
<%= classedName %> = {}
beforeEach inject (_<%= classedName %>_) ->
<%= classedName %> = _<%= classedName %>_
<%= cameledName %> = {}
beforeEach inject (_<%= cameledName %>_) ->
<%= cameledName %> = _<%= cameledName %>_

it 'should do something', () ->
expect(!!<%= classedName %>).toBe true
expect(!!<%= cameledName %>).toBe true
10 changes: 5 additions & 5 deletions templates/coffeescript/spec/service.coffee
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
'use strict'

describe 'Service: <%= classedName %>', () ->
describe 'Service: <%= cameledName %>', () ->

# load the service's module
beforeEach module '<%= scriptAppName %>'

# instantiate service
<%= classedName %> = {}
beforeEach inject (_<%= classedName %>_) ->
<%= classedName %> = _<%= classedName %>_
<%= cameledName %> = {}
beforeEach inject (_<%= cameledName %>_) ->
<%= cameledName %> = _<%= cameledName %>_

it 'should do something', () ->
expect(!!<%= classedName %>).toBe true
expect(!!<%= cameledName %>).toBe true
10 changes: 5 additions & 5 deletions templates/javascript-min/spec/service.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
'use strict';

describe('Service: <%= classedName %>', function () {
describe('Service: <%= cameledName %>', function () {

// load the service's module
beforeEach(module('<%= scriptAppName %>'));

// instantiate service
var <%= classedName %>;
beforeEach(inject(function(_<%= classedName %>_) {
<%= classedName %> = _<%= classedName %>_;
var <%= cameledName %>;
beforeEach(inject(function(_<%= cameledName %>_) {
<%= cameledName %> = _<%= cameledName %>_;
}));

it('should do something', function () {
expect(!!<%= classedName %>).toBe(true);
expect(!!<%= cameledName %>).toBe(true);
});

});
10 changes: 5 additions & 5 deletions templates/javascript/spec/service.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
'use strict';

describe('Service: <%= classedName %>', function () {
describe('Service: <%= cameledName %>', function () {

// load the service's module
beforeEach(module('<%= scriptAppName %>'));

// instantiate service
var <%= classedName %>;
beforeEach(inject(function (_<%= classedName %>_) {
<%= classedName %> = _<%= classedName %>_;
var <%= cameledName %>;
beforeEach(inject(function (_<%= cameledName %>_) {
<%= cameledName %> = _<%= cameledName %>_;
}));

it('should do something', function () {
expect(!!<%= classedName %>).toBe(true);
expect(!!<%= cameledName %>).toBe(true);
});

});
4 changes: 2 additions & 2 deletions test/test-file-creation.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ describe('Angular generator', function () {

describe('Service', function () {
function serviceTest (generatorType, nameFn, done) {
generatorTest(generatorType, 'service', 'services', nameFn, _.classify, '', done);
};
generatorTest(generatorType, 'service', 'services', nameFn, nameFn, '', done);
}

it('should generate a new constant', function (done) {
serviceTest('constant', _.camelize, done);
Expand Down

0 comments on commit 56a71a8

Please sign in to comment.