From d7fb3984a21d2b470c928c25df3bee1e2836a59c Mon Sep 17 00:00:00 2001 From: Amos Haviv Date: Wed, 2 Apr 2014 19:34:32 +0300 Subject: [PATCH] Complete Cleanup --- app/routes/articles.js | 9 +- app/routes/users.js | 3 + app/tests/articles.js | 81 ++--- app/tests/users.js | 102 +++--- package.json | 2 +- public/modules/articles/articles.js | 2 +- public/modules/articles/config/routes.js | 4 +- .../modules/articles/controllers/articles.js | 2 +- public/modules/articles/services/articles.js | 4 +- .../modules/articles/tests/articles.spec.js | 326 +++++++++--------- public/modules/core/config/routes.js | 2 +- public/modules/core/controllers/header.js | 2 +- public/modules/core/controllers/home.js | 2 +- public/modules/core/core.js | 2 +- public/modules/core/tests/header.spec.js | 30 +- public/modules/core/tests/home.spec.js | 30 +- public/modules/users/config/config.js | 2 +- public/modules/users/config/routes.js | 2 +- .../users/controllers/authentication.js | 2 +- public/modules/users/controllers/settings.js | 2 +- .../modules/users/services/authentication.js | 4 +- public/modules/users/services/users.js | 4 +- public/modules/users/users.js | 2 +- 23 files changed, 312 insertions(+), 309 deletions(-) diff --git a/app/routes/articles.js b/app/routes/articles.js index e6739a8a3c..c0d39095a9 100644 --- a/app/routes/articles.js +++ b/app/routes/articles.js @@ -1,9 +1,12 @@ 'use strict'; -module.exports = function(app) { - var users = require('../../app/controllers/users'); - var articles = require('../../app/controllers/articles'); +/** + * Module dependencies. + */ +var users = require('../../app/controllers/users'), + articles = require('../../app/controllers/articles'); +module.exports = function(app) { // Article Routes app.get('/articles', articles.list); app.post('/articles', users.requiresLogin, articles.create); diff --git a/app/routes/users.js b/app/routes/users.js index c5c3590660..96e9903d71 100644 --- a/app/routes/users.js +++ b/app/routes/users.js @@ -1,5 +1,8 @@ 'use strict'; +/** + * Module dependencies. + */ var passport = require('passport'); module.exports = function(app) { diff --git a/app/tests/articles.js b/app/tests/articles.js index 67e700c01f..e3dd60c889 100644 --- a/app/tests/articles.js +++ b/app/tests/articles.js @@ -8,56 +8,57 @@ var should = require('should'), User = mongoose.model('User'), Article = mongoose.model('Article'); -//Globals -var user; -var article; - -//The tests -describe('', function() { - describe('Model Article:', function() { - beforeEach(function(done) { - user = new User({ - firstName: 'Full', - lastName: 'Name', - displayName: 'Full Name', - email: 'test@test.com', - username: 'username', - password: 'password' - }); +/** + * Globals + */ +var user, article; - user.save(function() { - article = new Article({ - title: 'Article Title', - content: 'Article Content', - user: user - }); +/** + * Unit tests + */ +describe('Article Model Unit Tests:', function() { + beforeEach(function(done) { + user = new User({ + firstName: 'Full', + lastName: 'Name', + displayName: 'Full Name', + email: 'test@test.com', + username: 'username', + password: 'password' + }); - done(); + user.save(function() { + article = new Article({ + title: 'Article Title', + content: 'Article Content', + user: user }); + + done(); }); + }); - describe('Method Save', function() { - it('should be able to save without problems', function(done) { - return article.save(function(err) { - should.not.exist(err); - done(); - }); + describe('Method Save', function() { + it('should be able to save without problems', function(done) { + return article.save(function(err) { + should.not.exist(err); + done(); }); + }); - it('should be able to show an error when try to save without title', function(done) { - article.title = ''; + it('should be able to show an error when try to save without title', function(done) { + article.title = ''; - return article.save(function(err) { - should.exist(err); - done(); - }); + return article.save(function(err) { + should.exist(err); + done(); }); }); + }); - afterEach(function(done) { - Article.remove().exec(); - User.remove().exec(); - done(); - }); + afterEach(function(done) { + Article.remove().exec(); + User.remove().exec(); + done(); }); }); \ No newline at end of file diff --git a/app/tests/users.js b/app/tests/users.js index 6b7cd884ab..d76bafe53d 100644 --- a/app/tests/users.js +++ b/app/tests/users.js @@ -7,67 +7,69 @@ var should = require('should'), mongoose = require('mongoose'), User = mongoose.model('User'); -//Globals +/** + * Globals + */ var user, user2; -//The tests -describe('', function() { - describe('Model User:', function() { - before(function(done) { - user = new User({ - firstName: 'Full', - lastName: 'Name', - displayName: 'Full Name', - email: 'test@test.com', - username: 'username', - password: 'password', - provider: 'local' - }); - user2 = new User({ - firstName: 'Full', - lastName: 'Name', - displayName: 'Full Name', - email: 'test@test.com', - username: 'username', - password: 'password', - provider: 'local' - }); - - done(); +/** + * Unit tests + */ +describe('User Model Unit Tests:', function() { + before(function(done) { + user = new User({ + firstName: 'Full', + lastName: 'Name', + displayName: 'Full Name', + email: 'test@test.com', + username: 'username', + password: 'password', + provider: 'local' + }); + user2 = new User({ + firstName: 'Full', + lastName: 'Name', + displayName: 'Full Name', + email: 'test@test.com', + username: 'username', + password: 'password', + provider: 'local' }); - describe('Method Save', function() { - it('should begin with no users', function(done) { - User.find({}, function(err, users) { - users.should.have.length(0); - done(); - }); - }); + done(); + }); - it('should be able to save whithout problems', function(done) { - user.save(done); + describe('Method Save', function() { + it('should begin with no users', function(done) { + User.find({}, function(err, users) { + users.should.have.length(0); + done(); }); + }); - it('should fail to save an existing user again', function(done) { - user.save(); - return user2.save(function(err) { - should.exist(err); - done(); - }); - }); + it('should be able to save whithout problems', function(done) { + user.save(done); + }); - it('should be able to show an error when try to save without first name', function(done) { - user.firstName = ''; - return user.save(function(err) { - should.exist(err); - done(); - }); + it('should fail to save an existing user again', function(done) { + user.save(); + return user2.save(function(err) { + should.exist(err); + done(); }); }); - after(function(done) { - User.remove().exec(); - done(); + it('should be able to show an error when try to save without first name', function(done) { + user.firstName = ''; + return user.save(function(err) { + should.exist(err); + done(); + }); }); }); + + after(function(done) { + User.remove().exec(); + done(); + }); }); \ No newline at end of file diff --git a/package.json b/package.json index 90e59e89f7..526950714c 100755 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "grunt-env": "~0.4.1", "grunt-node-inspector": "~0.1.3", "grunt-contrib-watch": "~0.6.1", - "grunt-contrib-jshint": "~0.9.2", + "grunt-contrib-jshint": "~0.10.0", "grunt-nodemon": "~0.2.0", "grunt-concurrent": "~0.5.0", "grunt-mocha-test": "~0.10.0", diff --git a/public/modules/articles/articles.js b/public/modules/articles/articles.js index ccc37b429b..7435fc78a8 100755 --- a/public/modules/articles/articles.js +++ b/public/modules/articles/articles.js @@ -1,4 +1,4 @@ 'use strict'; // Use Applicaion configuration module to register a new module -ApplicationConfiguration.registerModule('mean.articles'); \ No newline at end of file +ApplicationConfiguration.registerModule('articles'); \ No newline at end of file diff --git a/public/modules/articles/config/routes.js b/public/modules/articles/config/routes.js index 3ba5fa75d6..5d5b8dad4e 100755 --- a/public/modules/articles/config/routes.js +++ b/public/modules/articles/config/routes.js @@ -1,7 +1,7 @@ 'use strict'; -//Setting up route -angular.module('mean.articles').config(['$stateProvider', +// Setting up route +angular.module('articles').config(['$stateProvider', function($stateProvider) { // Articles state routing $stateProvider. diff --git a/public/modules/articles/controllers/articles.js b/public/modules/articles/controllers/articles.js index 79d8ccefd7..27eee82fdc 100644 --- a/public/modules/articles/controllers/articles.js +++ b/public/modules/articles/controllers/articles.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('mean.articles').controller('ArticlesController', ['$scope', '$stateParams', '$location', 'Authentication', 'Articles', +angular.module('articles').controller('ArticlesController', ['$scope', '$stateParams', '$location', 'Authentication', 'Articles', function($scope, $stateParams, $location, Authentication, Articles) { $scope.authentication = Authentication; diff --git a/public/modules/articles/services/articles.js b/public/modules/articles/services/articles.js index 69f9be88a7..989f4ecc9d 100644 --- a/public/modules/articles/services/articles.js +++ b/public/modules/articles/services/articles.js @@ -1,7 +1,7 @@ 'use strict'; -//Articles service used for articles REST endpoint -angular.module('mean.articles').factory('Articles', ['$resource', function($resource) { +//Articles service used for communicating with the articles REST endpoints +angular.module('articles').factory('Articles', ['$resource', function($resource) { return $resource('articles/:articleId', { articleId: '@_id' }, { diff --git a/public/modules/articles/tests/articles.spec.js b/public/modules/articles/tests/articles.spec.js index a1d1599016..7e25c699bb 100644 --- a/public/modules/articles/tests/articles.spec.js +++ b/public/modules/articles/tests/articles.spec.js @@ -2,171 +2,169 @@ (function() { // Articles Controller Spec - describe('MEAN controllers', function() { - describe('ArticlesController', function() { - // Initialize global variables - var ArticlesController, - scope, - $httpBackend, - $stateParams, - $location; - - // The $resource service augments the response object with methods for updating and deleting the resource. - // If we were to use the standard toEqual matcher, our tests would fail because the test values would not match - // the responses exactly. To solve the problem, we define a new toEqualData Jasmine matcher. - // When the toEqualData matcher compares two objects, it takes only object properties into - // account and ignores methods. - beforeEach(function() { - jasmine.addMatchers({ - toEqualData: function(util, customEqualityTesters) { - return { - compare: function(actual, expected) { - return { - pass: angular.equals(actual, expected) - }; - } - }; - } - }); + describe('ArticlesController', function() { + // Initialize global variables + var ArticlesController, + scope, + $httpBackend, + $stateParams, + $location; + + // The $resource service augments the response object with methods for updating and deleting the resource. + // If we were to use the standard toEqual matcher, our tests would fail because the test values would not match + // the responses exactly. To solve the problem, we define a new toEqualData Jasmine matcher. + // When the toEqualData matcher compares two objects, it takes only object properties into + // account and ignores methods. + beforeEach(function() { + jasmine.addMatchers({ + toEqualData: function(util, customEqualityTesters) { + return { + compare: function(actual, expected) { + return { + pass: angular.equals(actual, expected) + }; + } + }; + } }); - - // Then we can start by loading the main application module - beforeEach(module('mean')); - - // The injector ignores leading and trailing underscores here (i.e. _$httpBackend_). - // This allows us to inject a service but then attach it to a variable - // with the same name as the service. - beforeEach(inject(function($controller, $rootScope, _$location_, _$stateParams_, _$httpBackend_) { - // Set a new global scope - scope = $rootScope.$new(); - - // Point global variables to injected services - $stateParams = _$stateParams_; - $httpBackend = _$httpBackend_; - $location = _$location_; - - // Initialize the Articles controller. - ArticlesController = $controller('ArticlesController', { - $scope: scope - }); - })); - - it('$scope.find() should create an array with at least one article object fetched from XHR', inject(function(Articles) { - // Create sample article using the Articles service - var sampleArticle = new Articles({ - title: 'An Article about MEAN', - content: 'MEAN rocks!' - }); - - // Create a sample articles array that includes the new article - var sampleArticles = [sampleArticle]; - - // Set GET response - $httpBackend.expectGET('articles').respond(sampleArticles); - - // Run controller functionality - scope.find(); - $httpBackend.flush(); - - // Test scope value - expect(scope.articles).toEqualData(sampleArticles); - })); - - it('$scope.findOne() should create an array with one article object fetched from XHR using a articleId URL parameter', inject(function(Articles) { - // Define a sample article object - var sampleArticle = new Articles({ - title: 'An Article about MEAN', - content: 'MEAN rocks!' - }); - - // Set the URL parameter - $stateParams.articleId = '525a8422f6d0f87f0e407a33'; - - // Set GET response - $httpBackend.expectGET(/articles\/([0-9a-fA-F]{24})$/).respond(sampleArticle); - - // Run controller functionality - scope.findOne(); - $httpBackend.flush(); - - // Test scope value - expect(scope.article).toEqualData(sampleArticle); - })); - - it('$scope.create() with valid form data should send a POST request with the form input values and then locate to new object URL', inject(function(Articles) { - // Create a sample article object - var sampleArticlePostData = new Articles({ - title: 'An Article about MEAN', - content: 'MEAN rocks!' - }); - - // Create a sample article response - var sampleArticleResponse = new Articles({ - _id: '525cf20451979dea2c000001', - title: 'An Article about MEAN', - content: 'MEAN rocks!' - }); - - // Fixture mock form input values - scope.title = 'An Article about MEAN'; - scope.content = 'MEAN rocks!'; - - // Set POST response - $httpBackend.expectPOST('articles', sampleArticlePostData).respond(sampleArticleResponse); - - // Run controller functionality - scope.create(); - $httpBackend.flush(); - - // Test form inputs are reset - expect(scope.title).toEqual(''); - expect(scope.content).toEqual(''); - - // Test URL redirection after the article was created - expect($location.path()).toBe('/articles/' + sampleArticleResponse._id); - })); - - it('$scope.update() should update a valid article', inject(function(Articles) { - // Define a sample article put data - var sampleArticlePutData = new Articles({ - _id: '525cf20451979dea2c000001', - title: 'An Article about MEAN', - content: 'MEAN Rocks!' - }); - - // Mock article in scope - scope.article = sampleArticlePutData; - - // Set PUT response - $httpBackend.expectPUT(/articles\/([0-9a-fA-F]{24})$/).respond(); - - // Run controller functionality - scope.update(); - $httpBackend.flush(); - - // Test URL location to new object - expect($location.path()).toBe('/articles/' + sampleArticlePutData._id); - })); - - it('$scope.remove() should send a DELETE request with a valid articleId and remove the article from the scope', inject(function(Articles) { - // Create new article object - var sampleArticle = new Articles({ - _id: '525a8422f6d0f87f0e407a33' - }); - - // Create new articles array and include the article - scope.articles = [sampleArticle]; - - // Set expected DELETE response - $httpBackend.expectDELETE(/articles\/([0-9a-fA-F]{24})$/).respond(204); - - // Run controller functionality - scope.remove(sampleArticle); - $httpBackend.flush(); - - // Test array after successful delete - expect(scope.articles.length).toBe(0); - })); }); + + // Then we can start by loading the main application module + beforeEach(module(ApplicationConfiguration.applicationModuleName)); + + // The injector ignores leading and trailing underscores here (i.e. _$httpBackend_). + // This allows us to inject a service but then attach it to a variable + // with the same name as the service. + beforeEach(inject(function($controller, $rootScope, _$location_, _$stateParams_, _$httpBackend_) { + // Set a new global scope + scope = $rootScope.$new(); + + // Point global variables to injected services + $stateParams = _$stateParams_; + $httpBackend = _$httpBackend_; + $location = _$location_; + + // Initialize the Articles controller. + ArticlesController = $controller('ArticlesController', { + $scope: scope + }); + })); + + it('$scope.find() should create an array with at least one article object fetched from XHR', inject(function(Articles) { + // Create sample article using the Articles service + var sampleArticle = new Articles({ + title: 'An Article about MEAN', + content: 'MEAN rocks!' + }); + + // Create a sample articles array that includes the new article + var sampleArticles = [sampleArticle]; + + // Set GET response + $httpBackend.expectGET('articles').respond(sampleArticles); + + // Run controller functionality + scope.find(); + $httpBackend.flush(); + + // Test scope value + expect(scope.articles).toEqualData(sampleArticles); + })); + + it('$scope.findOne() should create an array with one article object fetched from XHR using a articleId URL parameter', inject(function(Articles) { + // Define a sample article object + var sampleArticle = new Articles({ + title: 'An Article about MEAN', + content: 'MEAN rocks!' + }); + + // Set the URL parameter + $stateParams.articleId = '525a8422f6d0f87f0e407a33'; + + // Set GET response + $httpBackend.expectGET(/articles\/([0-9a-fA-F]{24})$/).respond(sampleArticle); + + // Run controller functionality + scope.findOne(); + $httpBackend.flush(); + + // Test scope value + expect(scope.article).toEqualData(sampleArticle); + })); + + it('$scope.create() with valid form data should send a POST request with the form input values and then locate to new object URL', inject(function(Articles) { + // Create a sample article object + var sampleArticlePostData = new Articles({ + title: 'An Article about MEAN', + content: 'MEAN rocks!' + }); + + // Create a sample article response + var sampleArticleResponse = new Articles({ + _id: '525cf20451979dea2c000001', + title: 'An Article about MEAN', + content: 'MEAN rocks!' + }); + + // Fixture mock form input values + scope.title = 'An Article about MEAN'; + scope.content = 'MEAN rocks!'; + + // Set POST response + $httpBackend.expectPOST('articles', sampleArticlePostData).respond(sampleArticleResponse); + + // Run controller functionality + scope.create(); + $httpBackend.flush(); + + // Test form inputs are reset + expect(scope.title).toEqual(''); + expect(scope.content).toEqual(''); + + // Test URL redirection after the article was created + expect($location.path()).toBe('/articles/' + sampleArticleResponse._id); + })); + + it('$scope.update() should update a valid article', inject(function(Articles) { + // Define a sample article put data + var sampleArticlePutData = new Articles({ + _id: '525cf20451979dea2c000001', + title: 'An Article about MEAN', + content: 'MEAN Rocks!' + }); + + // Mock article in scope + scope.article = sampleArticlePutData; + + // Set PUT response + $httpBackend.expectPUT(/articles\/([0-9a-fA-F]{24})$/).respond(); + + // Run controller functionality + scope.update(); + $httpBackend.flush(); + + // Test URL location to new object + expect($location.path()).toBe('/articles/' + sampleArticlePutData._id); + })); + + it('$scope.remove() should send a DELETE request with a valid articleId and remove the article from the scope', inject(function(Articles) { + // Create new article object + var sampleArticle = new Articles({ + _id: '525a8422f6d0f87f0e407a33' + }); + + // Create new articles array and include the article + scope.articles = [sampleArticle]; + + // Set expected DELETE response + $httpBackend.expectDELETE(/articles\/([0-9a-fA-F]{24})$/).respond(204); + + // Run controller functionality + scope.remove(sampleArticle); + $httpBackend.flush(); + + // Test array after successful delete + expect(scope.articles.length).toBe(0); + })); }); }()); \ No newline at end of file diff --git a/public/modules/core/config/routes.js b/public/modules/core/config/routes.js index 96b7ea0d9b..270503b413 100755 --- a/public/modules/core/config/routes.js +++ b/public/modules/core/config/routes.js @@ -1,7 +1,7 @@ 'use strict'; // Setting up route -angular.module('mean.core').config(['$stateProvider', '$urlRouterProvider', +angular.module('core').config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) { // Redirect to home view when route not found $urlRouterProvider.otherwise('/'); diff --git a/public/modules/core/controllers/header.js b/public/modules/core/controllers/header.js index 92557351ab..c603172914 100644 --- a/public/modules/core/controllers/header.js +++ b/public/modules/core/controllers/header.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('mean.core').controller('HeaderController', ['$scope', 'Authentication', +angular.module('core').controller('HeaderController', ['$scope', 'Authentication', function($scope, Authentication) { $scope.authentication = Authentication; $scope.isCollapsed = false; diff --git a/public/modules/core/controllers/home.js b/public/modules/core/controllers/home.js index 68e9dc9055..7c5edf3858 100644 --- a/public/modules/core/controllers/home.js +++ b/public/modules/core/controllers/home.js @@ -1,5 +1,5 @@ 'use strict'; -angular.module('mean.core').controller('HomeController', ['$scope', 'Authentication', function ($scope, Authentication) { +angular.module('core').controller('HomeController', ['$scope', 'Authentication', function ($scope, Authentication) { $scope.authentication = Authentication; }]); \ No newline at end of file diff --git a/public/modules/core/core.js b/public/modules/core/core.js index d4aeb10664..0edda0458d 100755 --- a/public/modules/core/core.js +++ b/public/modules/core/core.js @@ -1,4 +1,4 @@ 'use strict'; // Use Applicaion configuration module to register a new module -ApplicationConfiguration.registerModule('mean.core'); \ No newline at end of file +ApplicationConfiguration.registerModule('core'); \ No newline at end of file diff --git a/public/modules/core/tests/header.spec.js b/public/modules/core/tests/header.spec.js index 5d25e3bfec..76ee4fb4e7 100644 --- a/public/modules/core/tests/header.spec.js +++ b/public/modules/core/tests/header.spec.js @@ -1,26 +1,24 @@ 'use strict'; (function() { - describe('MEAN controllers', function() { - describe('HeaderController', function() { - //Initialize global variables - var scope, - HeaderController; + describe('HeaderController', function() { + //Initialize global variables + var scope, + HeaderController; - // Load the main application module - beforeEach(module('mean')); + // Load the main application module + beforeEach(module(ApplicationConfiguration.applicationModuleName)); - beforeEach(inject(function($controller, $rootScope) { - scope = $rootScope.$new(); + beforeEach(inject(function($controller, $rootScope) { + scope = $rootScope.$new(); - HeaderController = $controller('HeaderController', { - $scope: scope - }); - })); - - it('should expose the authentication service', function() { - expect(scope.authentication).toBeTruthy(); + HeaderController = $controller('HeaderController', { + $scope: scope }); + })); + + it('should expose the authentication service', function() { + expect(scope.authentication).toBeTruthy(); }); }); })(); \ No newline at end of file diff --git a/public/modules/core/tests/home.spec.js b/public/modules/core/tests/home.spec.js index b70d6be385..a5b1a566d5 100644 --- a/public/modules/core/tests/home.spec.js +++ b/public/modules/core/tests/home.spec.js @@ -1,26 +1,24 @@ 'use strict'; (function() { - describe('MEAN controllers', function() { - describe('HomeController', function() { - //Initialize global variables - var scope, - HomeController; + describe('HomeController', function() { + //Initialize global variables + var scope, + HomeController; - // Load the main application module - beforeEach(module('mean')); + // Load the main application module + beforeEach(module(ApplicationConfiguration.applicationModuleName)); - beforeEach(inject(function($controller, $rootScope) { - scope = $rootScope.$new(); + beforeEach(inject(function($controller, $rootScope) { + scope = $rootScope.$new(); - HomeController = $controller('HomeController', { - $scope: scope - }); - })); - - it('should expose the authentication service', function() { - expect(scope.authentication).toBeTruthy(); + HomeController = $controller('HomeController', { + $scope: scope }); + })); + + it('should expose the authentication service', function() { + expect(scope.authentication).toBeTruthy(); }); }); })(); \ No newline at end of file diff --git a/public/modules/users/config/config.js b/public/modules/users/config/config.js index 1c52c8a2a8..0bfc8b640b 100644 --- a/public/modules/users/config/config.js +++ b/public/modules/users/config/config.js @@ -1,7 +1,7 @@ 'use strict'; // Config HTTP Error Handling -angular.module('mean.users').config(['$httpProvider', +angular.module('users').config(['$httpProvider', function($httpProvider) { // Set the httpProvider "not authorized" interceptor $httpProvider.interceptors.push(['$q', '$location', 'Authentication', diff --git a/public/modules/users/config/routes.js b/public/modules/users/config/routes.js index 942e8058ae..12d8a0a05b 100755 --- a/public/modules/users/config/routes.js +++ b/public/modules/users/config/routes.js @@ -1,7 +1,7 @@ 'use strict'; // Setting up route -angular.module('mean.users').config(['$stateProvider', +angular.module('users').config(['$stateProvider', function($stateProvider) { // Users state routing $stateProvider. diff --git a/public/modules/users/controllers/authentication.js b/public/modules/users/controllers/authentication.js index ffa4617161..a4ac880a25 100644 --- a/public/modules/users/controllers/authentication.js +++ b/public/modules/users/controllers/authentication.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('mean.users').controller('AuthenticationController', ['$scope', '$http', '$location', 'Authentication', +angular.module('users').controller('AuthenticationController', ['$scope', '$http', '$location', 'Authentication', function($scope, $http, $location, Authentication) { $scope.authentication = Authentication; diff --git a/public/modules/users/controllers/settings.js b/public/modules/users/controllers/settings.js index e766fdc280..1715b2bbb5 100644 --- a/public/modules/users/controllers/settings.js +++ b/public/modules/users/controllers/settings.js @@ -1,6 +1,6 @@ 'use strict'; -angular.module('mean.users').controller('SettingsController', ['$scope', '$http', '$location', 'Users', 'Authentication', +angular.module('users').controller('SettingsController', ['$scope', '$http', '$location', 'Users', 'Authentication', function($scope, $http, $location, Users, Authentication) { $scope.user = Authentication.user; diff --git a/public/modules/users/services/authentication.js b/public/modules/users/services/authentication.js index 4aa6e87b24..4418b2d7fd 100644 --- a/public/modules/users/services/authentication.js +++ b/public/modules/users/services/authentication.js @@ -1,7 +1,7 @@ 'use strict'; -//Authentication service for user variables -angular.module('mean.users').factory('Authentication', [ +// Authentication service for user variables +angular.module('users').factory('Authentication', [ function() { var _this = this; diff --git a/public/modules/users/services/users.js b/public/modules/users/services/users.js index 3ab57c1301..664828f0a5 100644 --- a/public/modules/users/services/users.js +++ b/public/modules/users/services/users.js @@ -1,7 +1,7 @@ 'use strict'; -//Users service used for users REST endpoint -angular.module('mean.users').factory('Users', ['$resource', +// Users service used for communicating with the users REST endpoint +angular.module('users').factory('Users', ['$resource', function($resource) { return $resource('users', {}, { update: { diff --git a/public/modules/users/users.js b/public/modules/users/users.js index c204eb04c5..b11998607b 100755 --- a/public/modules/users/users.js +++ b/public/modules/users/users.js @@ -1,4 +1,4 @@ 'use strict'; // Use Applicaion configuration module to register a new module -ApplicationConfiguration.registerModule('mean.users'); \ No newline at end of file +ApplicationConfiguration.registerModule('users'); \ No newline at end of file