using uibModal instead of modal / getting ready for using my custo SonarQube JavaScri...
authorgustavo <gu.martinm@gmail.com>
Sun, 21 Aug 2016 20:53:41 +0000 (22:53 +0200)
committergustavo <gu.martinm@gmail.com>
Sun, 21 Aug 2016 20:53:41 +0000 (22:53 +0200)
27 files changed:
angularjs/showcase/karma.conf.js
angularjs/showcase/src/showcase/app/cars/cars-error-modal.controller.js.spec [new file with mode: 0644]
angularjs/showcase/src/showcase/app/cars/cars-error-modal.controller.spec.js [deleted file]
angularjs/showcase/src/showcase/app/cars/cars.controller.js.spec [new file with mode: 0644]
angularjs/showcase/src/showcase/app/cars/cars.controller.spec.js [deleted file]
angularjs/showcase/src/showcase/app/cars/cars.route.js.spec [new file with mode: 0644]
angularjs/showcase/src/showcase/app/cars/cars.route.spec.js [deleted file]
angularjs/showcase/src/showcase/app/cars/cars.service.js.spec [new file with mode: 0644]
angularjs/showcase/src/showcase/app/cars/cars.service.spec.js [deleted file]
angularjs/showcase/src/showcase/app/users/users-child.controller.js.spec [new file with mode: 0644]
angularjs/showcase/src/showcase/app/users/users-child.controller.spec.js [deleted file]
angularjs/showcase/src/showcase/app/users/users-second-child.controller.js.spec [new file with mode: 0644]
angularjs/showcase/src/showcase/app/users/users-second-child.controller.spec.js [deleted file]
angularjs/showcase/src/showcase/app/users/users.controller.js.spec [new file with mode: 0644]
angularjs/showcase/src/showcase/app/users/users.controller.spec.js [deleted file]
angularjs/showcase/src/showcase/app/users/users.route.js.spec [new file with mode: 0644]
angularjs/showcase/src/showcase/app/users/users.route.spec.js [deleted file]
angularjs/showcase/src/showcase/app/welcome/welcome-account.controller.js.spec [new file with mode: 0644]
angularjs/showcase/src/showcase/app/welcome/welcome-account.controller.spec.js [deleted file]
angularjs/showcase/src/showcase/app/welcome/welcome-account.directive.js.spec [new file with mode: 0644]
angularjs/showcase/src/showcase/app/welcome/welcome-account.directive.spec.js [deleted file]
angularjs/showcase/src/showcase/app/welcome/welcome.controller.js.spec [new file with mode: 0644]
angularjs/showcase/src/showcase/app/welcome/welcome.controller.spec.js [deleted file]
angularjs/showcase/src/showcase/app/welcome/welcome.route.js.spec [new file with mode: 0644]
angularjs/showcase/src/showcase/app/welcome/welcome.route.spec.js [deleted file]
angularjs/showcase/src/showcase/app/widgets/example-controller-as.directive.js.spec [new file with mode: 0644]
angularjs/showcase/src/showcase/app/widgets/example-controller-as.directive.spec.js [deleted file]

index 15ca427..52f1a9d 100644 (file)
@@ -35,6 +35,7 @@ module.exports = function(config) {
       //endbower
       'src/showcase/app/**/*.module.js',
       'src/showcase/app/**/*.js',
+      'src/showcase/app/**/*.js.spec',
       '.tmp/templates.js'
     ],
 
diff --git a/angularjs/showcase/src/showcase/app/cars/cars-error-modal.controller.js.spec b/angularjs/showcase/src/showcase/app/cars/cars-error-modal.controller.js.spec
new file mode 100644 (file)
index 0000000..9ec61e0
--- /dev/null
@@ -0,0 +1,39 @@
+describe('app.cars', function() {
+  'use strict';
+
+  var cars = ['car1', 'car2', 'car3'];
+  var $modalInstance = {
+    close: jasmine.createSpy('modalInstance.close'),
+    dismiss: jasmine.createSpy('modalInstance.dismiss')
+  };
+  var CarsErrorModalController;
+
+  beforeEach(function() {
+    module('app.cars');
+
+    inject(function($controller) {
+      CarsErrorModalController = $controller('CarsErrorModalController', {
+        $modalInstance: $modalInstance,
+        cars: cars
+      });
+    });
+
+  });
+
+  describe('CarsErrorModalController', function () {
+
+    it('should invoke $modalInstance.close', function () {
+      CarsErrorModalController.ok();
+
+      expect($modalInstance.close).toHaveBeenCalledWith('car1');
+    });
+
+    it('should invoke $modalInstance.dismiss', function () {
+      CarsErrorModalController.cancel();
+
+      expect($modalInstance.dismiss).toHaveBeenCalledWith('cancel');
+    });
+
+  });
+
+});
diff --git a/angularjs/showcase/src/showcase/app/cars/cars-error-modal.controller.spec.js b/angularjs/showcase/src/showcase/app/cars/cars-error-modal.controller.spec.js
deleted file mode 100644 (file)
index 9ec61e0..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-describe('app.cars', function() {
-  'use strict';
-
-  var cars = ['car1', 'car2', 'car3'];
-  var $modalInstance = {
-    close: jasmine.createSpy('modalInstance.close'),
-    dismiss: jasmine.createSpy('modalInstance.dismiss')
-  };
-  var CarsErrorModalController;
-
-  beforeEach(function() {
-    module('app.cars');
-
-    inject(function($controller) {
-      CarsErrorModalController = $controller('CarsErrorModalController', {
-        $modalInstance: $modalInstance,
-        cars: cars
-      });
-    });
-
-  });
-
-  describe('CarsErrorModalController', function () {
-
-    it('should invoke $modalInstance.close', function () {
-      CarsErrorModalController.ok();
-
-      expect($modalInstance.close).toHaveBeenCalledWith('car1');
-    });
-
-    it('should invoke $modalInstance.dismiss', function () {
-      CarsErrorModalController.cancel();
-
-      expect($modalInstance.dismiss).toHaveBeenCalledWith('cancel');
-    });
-
-  });
-
-});
diff --git a/angularjs/showcase/src/showcase/app/cars/cars.controller.js.spec b/angularjs/showcase/src/showcase/app/cars/cars.controller.js.spec
new file mode 100644 (file)
index 0000000..714657d
--- /dev/null
@@ -0,0 +1,316 @@
+describe('app.cars', function() {
+  'use strict';
+
+  var isSuccessCallBack = true;
+  var onFulfilledValue = 'car1';
+  var onRejectedValue = 'error';
+  // Why the heck do I need this stupid object if it is going to be spied by means of Jasmine?
+  // This is completely stupid and you will never see me doing something like this again!!!
+  // In this case, IMHO it is better to inject the real service (using the inject function, see below)
+  // and create as many spies as needed (and when there are required)
+  var cars = {
+    getAll: function() {
+      return {};
+    }
+  };
+  var CarsController;
+  var $q;
+
+  beforeEach(function() {
+    module('app.cars');
+
+    inject(function($controller, $uibModal, $timeout, _$q_) {
+      CarsController = $controller('CarsController', {
+        $uibModal: $uibModal,
+        $timeout: $timeout,
+        cars: cars
+      });
+      $q = _$q_;
+    });
+  });
+
+  describe('CarsController', function () {
+
+    it('should invoke GET all cars in service with success: old fashionable way', function () {
+
+      spyOn(cars, 'getAll')
+        .and.callFake(function() {
+          return {
+            then: function (successCallback, errorCallback) {
+              if (isSuccessCallBack) {
+                successCallback(onFulfilledValue);
+              } else {
+                errorCallback(onRejectedValue);
+              }
+            }
+          };
+        });
+
+      CarsController.getCars();
+
+      expect(cars.getAll).toHaveBeenCalled();
+      expect(CarsController.cars).toEqual(onFulfilledValue);
+    });
+  });
+
+});
+
+// I AM BEGINNING TO DISLIKE THIS WAY OF TESTING thenables.
+// I PREFER THE WAY USING $scope.$apply/$scope.$digest/$rootScope.$apply
+// SEE AT THE END THE WAY I THINK IS THE NICEST. THERE IS WAY LESS CODE AND IT IS MORE READEABLE!!!
+
+// GO TO THE END WHERE THERE ARE TESTS USING $scope.$apply() THEY ARE BETTER TESTS THAN THE ONES
+// HERE MOCKING THE then METHOD. THIS WAY REQUIRES TOO MUCH CODE AND IT IS NOT READEABLE :(
+// GO TO THE BOTTOM FOR THE COOL WAY OF TESTING THIS STUFF :)
+describe('app.cars', function() {
+  'use strict';
+
+  var isSuccessCallBack = true;
+  var onFulfilledValue = 'car1';
+  var onRejectedValue = 'error';
+  // With object already implementing the required spy :)
+  var cars = {
+    getAll: jasmine.createSpy('cars.getAll')
+      .and.callFake(function() {
+        return {
+          then: function (successCallback, errorCallback) {
+            if (isSuccessCallBack) {
+              successCallback(onFulfilledValue);
+            } else {
+              errorCallback(onRejectedValue);
+            }
+          }
+        };
+      })
+  };
+  var $modalInstance = {
+    close: jasmine.createSpy('$modalInstance.close'),
+    dismiss: jasmine.createSpy('$modalInstance.dismiss'),
+    result: {
+      then: jasmine.createSpy('$modalInstance.result.then')
+        .and.callFake(function(successCallback, errorCallback) {
+          if (isSuccessCallBack) {
+            successCallback(onFulfilledValue);
+          } else {
+            errorCallback(onRejectedValue);
+          }
+        })
+    },
+    opened: {
+      then: jasmine.createSpy('$modalInstance.opened.then')
+        .and.callFake(function(successCallback, errorCallback) {
+          if (isSuccessCallBack) {
+            successCallback(onFulfilledValue);
+          } else {
+            errorCallback(onRejectedValue);
+          }
+        })
+    },
+    rendered: {
+      then: jasmine.createSpy('$modalInstance.rendered.then')
+        .and.callFake(function(successCallback, errorCallback) {
+          if (isSuccessCallBack) {
+            successCallback(onFulfilledValue);
+          } else {
+            errorCallback(onRejectedValue);
+          }
+        })
+    }
+  };
+  var $uibModal = {
+    open: jasmine.createSpy('$uibModal.open')
+      .and.callFake(function() {
+        return $modalInstance;
+      })
+  };
+  var $timeout;
+  var CarsController;
+  var $q;
+
+  beforeEach(function() {
+    module('app.cars');
+
+    inject(function($controller, _$timeout_, _$q_) {
+      CarsController = $controller('CarsController', {
+        $uibModal: $uibModal,
+        $timeout: _$timeout_,
+        cars: cars
+      });
+      $q = _$q_;
+      $timeout = _$timeout_;
+    });
+  });
+
+  describe('CarsController', function () {
+
+    it('should invoke GET all cars in service with success: alternative way', function () {
+
+      CarsController.getCars();
+
+      expect(cars.getAll).toHaveBeenCalled();
+      expect(CarsController.cars).toEqual(onFulfilledValue);
+    });
+
+    it('should invoke GET all cars in service with error: alternative way', function () {
+      isSuccessCallBack = false;
+      spyOn(CarsController, 'doModal')
+        .and.callFake(function() {
+          return {};
+        });
+
+      CarsController.getCars();
+
+      expect(cars.getAll).toHaveBeenCalled();
+      expect(CarsController.doModal).toHaveBeenCalled();
+
+      isSuccessCallBack = true;
+    });
+
+    it('should invoke $modal.open', function () {
+
+      CarsController.doModal('lg');
+
+      expect($uibModal.open).toHaveBeenCalled();
+    });
+
+    it('should invoke $modalInstance.result with success', function () {
+
+      CarsController.doModal('lg');
+
+      expect($modalInstance.result.then).toHaveBeenCalled();
+      expect(CarsController.selected).toEqual(onFulfilledValue);
+    });
+
+    it('should invoke $modalInstance.result with error', function () {
+      isSuccessCallBack = false;
+
+      CarsController.doModal('lg');
+
+      expect($modalInstance.result.then).toHaveBeenCalled();
+
+      isSuccessCallBack = true;
+    });
+
+    it('should invoke $modalInstance.opened with success', function () {
+
+      CarsController.doModal('lg');
+
+      expect($modalInstance.opened.then).toHaveBeenCalled();
+
+    });
+
+    it('should invoke $modalInstance.opened with error', function () {
+      isSuccessCallBack = false;
+
+      CarsController.doModal('lg');
+
+      expect($modalInstance.opened.then).toHaveBeenCalled();
+
+      isSuccessCallBack = true;
+    });
+
+    it('should invoke $modalInstance.rendered with success', function () {
+
+      CarsController.doModal('lg');
+
+      expect($modalInstance.rendered.then).toHaveBeenCalled();
+
+    });
+
+    it('should invoke $modalInstance.rendered with error', function () {
+      isSuccessCallBack = false;
+
+      CarsController.doModal('lg');
+
+      expect($modalInstance.rendered.then).toHaveBeenCalled();
+
+      isSuccessCallBack = true;
+    });
+
+    it('should invoke $modalInstance.close because of timeout', function () {
+
+      CarsController.doModal('lg');
+      $timeout.flush();
+
+      expect($modalInstance.close).toHaveBeenCalledWith('closed by timeout');
+
+    });
+
+    it('should invoke $modalInstance.dismiss because of timeout', function () {
+
+      CarsController.doModal('lg');
+      $timeout.flush();
+
+      expect($modalInstance.dismiss).toHaveBeenCalledWith('dismissed by timeout');
+
+    });
+
+  });
+
+});
+
+describe('app.cars', function() {
+  'use strict';
+
+  var $rootScope;
+  var $scope;
+  var $q;
+
+  // I have to inject cars service in CarsController. Declaring here the cars variable enables me to use
+  // spies for this service in my tests. I do not create any stub, instead I will use the injected service by Jasmine
+  // (see just below)
+  var cars;
+
+  var CarsController;
+  var reason = 'error';
+  var value = 'car1';
+
+  beforeEach(function() {
+    module('app.cars');
+
+    inject(function($controller, $uibModal, $timeout, _$q_, _$rootScope_, _cars_) {
+      cars = _cars_;
+      CarsController = $controller('CarsController', {
+        $uibModal: $uibModal,
+        $timeout: $timeout,
+        cars: cars
+      });
+      $rootScope = _$rootScope_;
+      $q = _$q_;
+      $scope = $rootScope.$new();
+    });
+  });
+
+  describe('CarsController', function () {
+
+    it('should invoke GET all cars in service with success: using digest/apply', function () {
+      spyOn(cars, 'getAll')
+        .and.returnValue($q.resolve(value));
+
+      CarsController.getCars();
+
+      $scope.$apply();
+
+      expect(cars.getAll).toHaveBeenCalled();
+      expect(CarsController.cars).toEqual(value);
+    });
+
+    it('should invoke GET all cars in service with error: using digest/apply', function () {
+      spyOn(cars, 'getAll')
+        .and.returnValue($q.reject(reason));
+      spyOn(CarsController, 'doModal')
+        .and.callFake(function() {
+          return {};
+        });
+
+      CarsController.getCars();
+
+      $scope.$apply();
+
+      expect(cars.getAll).toHaveBeenCalled();
+      expect(CarsController.doModal).toHaveBeenCalled();
+    });
+
+  });
+
+});
diff --git a/angularjs/showcase/src/showcase/app/cars/cars.controller.spec.js b/angularjs/showcase/src/showcase/app/cars/cars.controller.spec.js
deleted file mode 100644 (file)
index adc7a4c..0000000
+++ /dev/null
@@ -1,316 +0,0 @@
-describe('app.cars', function() {
-  'use strict';
-
-  var isSuccessCallBack = true;
-  var onFulfilledValue = 'car1';
-  var onRejectedValue = 'error';
-  // Why the heck do I need this stupid object if it is going to be spied by means of Jasmine?
-  // This is completely stupid and you will never see me doing something like this again!!!
-  // In this case, IMHO it is better to inject the real service (using the inject function, see below)
-  // and create as many spies as needed (and when there are required)
-  var cars = {
-    getAll: function() {
-      return {};
-    }
-  };
-  var CarsController;
-  var $q;
-
-  beforeEach(function() {
-    module('app.cars');
-
-    inject(function($controller, $modal, $timeout, _$q_) {
-      CarsController = $controller('CarsController', {
-        $modal: $modal,
-        $timeout: $timeout,
-        cars: cars
-      });
-      $q = _$q_;
-    });
-  });
-
-  describe('CarsController', function () {
-
-    it('should invoke GET all cars in service with success: old fashionable way', function () {
-
-      spyOn(cars, 'getAll')
-        .and.callFake(function() {
-          return {
-            then: function (successCallback, errorCallback) {
-              if (isSuccessCallBack) {
-                successCallback(onFulfilledValue);
-              } else {
-                errorCallback(onRejectedValue);
-              }
-            }
-          };
-        });
-
-      CarsController.getCars();
-
-      expect(cars.getAll).toHaveBeenCalled();
-      expect(CarsController.cars).toEqual(onFulfilledValue);
-    });
-  });
-
-});
-
-// I AM BEGINNING TO DISLIKE THIS WAY OF TESTING thenables.
-// I PREFER THE WAY USING $scope.$apply/$scope.$digest/$rootScope.$apply
-// SEE AT THE END THE WAY I THINK IS THE NICEST. THERE IS WAY LESS CODE AND IT IS MORE READEABLE!!!
-
-// GO TO THE END WHERE THERE ARE TESTS USING $scope.$apply() THEY ARE BETTER TESTS THAN THE ONES
-// HERE MOCKING THE then METHOD. THIS WAY REQUIRES TOO MUCH CODE AND IT IS NOT READEABLE :(
-// GO TO THE BOTTOM FOR THE COOL WAY OF TESTING THIS STUFF :)
-describe('app.cars', function() {
-  'use strict';
-
-  var isSuccessCallBack = true;
-  var onFulfilledValue = 'car1';
-  var onRejectedValue = 'error';
-  // With object already implementing the required spy :)
-  var cars = {
-    getAll: jasmine.createSpy('cars.getAll')
-      .and.callFake(function() {
-        return {
-          then: function (successCallback, errorCallback) {
-            if (isSuccessCallBack) {
-              successCallback(onFulfilledValue);
-            } else {
-              errorCallback(onRejectedValue);
-            }
-          }
-        };
-      })
-  };
-  var $modalInstance = {
-    close: jasmine.createSpy('$modalInstance.close'),
-    dismiss: jasmine.createSpy('$modalInstance.dismiss'),
-    result: {
-      then: jasmine.createSpy('$modalInstance.result.then')
-        .and.callFake(function(successCallback, errorCallback) {
-          if (isSuccessCallBack) {
-            successCallback(onFulfilledValue);
-          } else {
-            errorCallback(onRejectedValue);
-          }
-        })
-    },
-    opened: {
-      then: jasmine.createSpy('$modalInstance.opened.then')
-        .and.callFake(function(successCallback, errorCallback) {
-          if (isSuccessCallBack) {
-            successCallback(onFulfilledValue);
-          } else {
-            errorCallback(onRejectedValue);
-          }
-        })
-    },
-    rendered: {
-      then: jasmine.createSpy('$modalInstance.rendered.then')
-        .and.callFake(function(successCallback, errorCallback) {
-          if (isSuccessCallBack) {
-            successCallback(onFulfilledValue);
-          } else {
-            errorCallback(onRejectedValue);
-          }
-        })
-    }
-  };
-  var $modal = {
-    open: jasmine.createSpy('$modal.open')
-      .and.callFake(function() {
-        return $modalInstance;
-      })
-  };
-  var $timeout;
-  var CarsController;
-  var $q;
-
-  beforeEach(function() {
-    module('app.cars');
-
-    inject(function($controller, _$timeout_, _$q_) {
-      CarsController = $controller('CarsController', {
-        $modal: $modal,
-        $timeout: _$timeout_,
-        cars: cars
-      });
-      $q = _$q_;
-      $timeout = _$timeout_;
-    });
-  });
-
-  describe('CarsController', function () {
-
-    it('should invoke GET all cars in service with success: alternative way', function () {
-
-      CarsController.getCars();
-
-      expect(cars.getAll).toHaveBeenCalled();
-      expect(CarsController.cars).toEqual(onFulfilledValue);
-    });
-
-    it('should invoke GET all cars in service with error: alternative way', function () {
-      isSuccessCallBack = false;
-      spyOn(CarsController, 'doModal')
-        .and.callFake(function() {
-          return {};
-        });
-
-      CarsController.getCars();
-
-      expect(cars.getAll).toHaveBeenCalled();
-      expect(CarsController.doModal).toHaveBeenCalled();
-
-      isSuccessCallBack = true;
-    });
-
-    it('should invoke $modal.open', function () {
-
-      CarsController.doModal('lg');
-
-      expect($modal.open).toHaveBeenCalled();
-    });
-
-    it('should invoke $modalInstance.result with success', function () {
-
-      CarsController.doModal('lg');
-
-      expect($modalInstance.result.then).toHaveBeenCalled();
-      expect(CarsController.selected).toEqual(onFulfilledValue);
-    });
-
-    it('should invoke $modalInstance.result with error', function () {
-      isSuccessCallBack = false;
-
-      CarsController.doModal('lg');
-
-      expect($modalInstance.result.then).toHaveBeenCalled();
-
-      isSuccessCallBack = true;
-    });
-
-    it('should invoke $modalInstance.opened with success', function () {
-
-      CarsController.doModal('lg');
-
-      expect($modalInstance.opened.then).toHaveBeenCalled();
-
-    });
-
-    it('should invoke $modalInstance.opened with error', function () {
-      isSuccessCallBack = false;
-
-      CarsController.doModal('lg');
-
-      expect($modalInstance.opened.then).toHaveBeenCalled();
-
-      isSuccessCallBack = true;
-    });
-
-    it('should invoke $modalInstance.rendered with success', function () {
-
-      CarsController.doModal('lg');
-
-      expect($modalInstance.rendered.then).toHaveBeenCalled();
-
-    });
-
-    it('should invoke $modalInstance.rendered with error', function () {
-      isSuccessCallBack = false;
-
-      CarsController.doModal('lg');
-
-      expect($modalInstance.rendered.then).toHaveBeenCalled();
-
-      isSuccessCallBack = true;
-    });
-
-    it('should invoke $modalInstance.close because of timeout', function () {
-
-      CarsController.doModal('lg');
-      $timeout.flush();
-
-      expect($modalInstance.close).toHaveBeenCalledWith('closed by timeout');
-
-    });
-
-    it('should invoke $modalInstance.dismiss because of timeout', function () {
-
-      CarsController.doModal('lg');
-      $timeout.flush();
-
-      expect($modalInstance.dismiss).toHaveBeenCalledWith('dismissed by timeout');
-
-    });
-
-  });
-
-});
-
-describe('app.cars', function() {
-  'use strict';
-
-  var $rootScope;
-  var $scope;
-  var $q;
-
-  // I have to inject cars service in CarsController. Declaring here the cars variable enables me to use
-  // spies for this service in my tests. I do not create any stub, instead I will use the injected service by Jasmine
-  // (see just below)
-  var cars;
-
-  var CarsController;
-  var reason = 'error';
-  var value = 'car1';
-
-  beforeEach(function() {
-    module('app.cars');
-
-    inject(function($controller, $modal, $timeout, _$q_, _$rootScope_, _cars_) {
-      cars = _cars_;
-      CarsController = $controller('CarsController', {
-        $modal: $modal,
-        $timeout: $timeout,
-        cars: cars
-      });
-      $rootScope = _$rootScope_;
-      $q = _$q_;
-      $scope = $rootScope.$new();
-    });
-  });
-
-  describe('CarsController', function () {
-
-    it('should invoke GET all cars in service with success: using digest/apply', function () {
-      spyOn(cars, 'getAll')
-        .and.returnValue($q.resolve(value));
-
-      CarsController.getCars();
-
-      $scope.$apply();
-
-      expect(cars.getAll).toHaveBeenCalled();
-      expect(CarsController.cars).toEqual(value);
-    });
-
-    it('should invoke GET all cars in service with error: using digest/apply', function () {
-      spyOn(cars, 'getAll')
-        .and.returnValue($q.reject(reason));
-      spyOn(CarsController, 'doModal')
-        .and.callFake(function() {
-          return {};
-        });
-
-      CarsController.getCars();
-
-      $scope.$apply();
-
-      expect(cars.getAll).toHaveBeenCalled();
-      expect(CarsController.doModal).toHaveBeenCalled();
-    });
-
-  });
-
-});
diff --git a/angularjs/showcase/src/showcase/app/cars/cars.route.js.spec b/angularjs/showcase/src/showcase/app/cars/cars.route.js.spec
new file mode 100644 (file)
index 0000000..f8c7b33
--- /dev/null
@@ -0,0 +1,24 @@
+describe('app.cars', function() {
+  'use strict';
+
+  describe('state', function() {
+    var view = {
+      cars: 'app/cars/cars.html'
+    };
+    var $state;
+
+    beforeEach(function() {
+      module('app.cars');
+
+      inject(function(_$state_) {
+        $state = _$state_;
+      });
+    });
+
+    it('should map /cars route to cars View template', function() {
+      expect($state.get('cars').templateUrl). toEqual(view.cars);
+    });
+
+  });
+
+});
diff --git a/angularjs/showcase/src/showcase/app/cars/cars.route.spec.js b/angularjs/showcase/src/showcase/app/cars/cars.route.spec.js
deleted file mode 100644 (file)
index f8c7b33..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-describe('app.cars', function() {
-  'use strict';
-
-  describe('state', function() {
-    var view = {
-      cars: 'app/cars/cars.html'
-    };
-    var $state;
-
-    beforeEach(function() {
-      module('app.cars');
-
-      inject(function(_$state_) {
-        $state = _$state_;
-      });
-    });
-
-    it('should map /cars route to cars View template', function() {
-      expect($state.get('cars').templateUrl). toEqual(view.cars);
-    });
-
-  });
-
-});
diff --git a/angularjs/showcase/src/showcase/app/cars/cars.service.js.spec b/angularjs/showcase/src/showcase/app/cars/cars.service.js.spec
new file mode 100644 (file)
index 0000000..4c7f454
--- /dev/null
@@ -0,0 +1,88 @@
+describe('app.cars', function() {
+  'use strict';
+
+  var $httpBackend;
+  var $log;
+  var id = 666;
+  var carResponseSuccess = {
+    content: 'Car: false',
+    id: id
+  };
+  var carsResponseSuccess = [
+    carResponseSuccess
+  ];
+  var carsResponseError = 'Error: connect ECONNREFUSED';
+  var cars;
+  var API;
+
+  beforeEach(function() {
+    module('app.cars');
+
+    inject(function(_$httpBackend_, _$log_, _cars_, _API_) {
+      $httpBackend = _$httpBackend_;
+      $log = _$log_;
+      cars = _cars_;
+      API = _API_;
+    });
+  });
+
+  describe('cars service', function () {
+
+    it('should invoke GET all cars without error', function () {
+      var respValue;
+
+      $httpBackend.expectGET(API.CARS).respond(200, carsResponseSuccess);
+      cars.getAll().then(function(resp) {
+        respValue = resp;
+      });
+      $httpBackend.flush();
+
+      expect(carsResponseSuccess).toEqual(respValue);
+    });
+
+    it('should invoke GET all cars with error', function () {
+      var reasonValue;
+
+      $httpBackend.expectGET(API.CARS).respond(400, carsResponseError);
+      cars.getAll().then(function() {}, function(reason) {
+        reasonValue = reason;
+      });
+      $httpBackend.flush();
+
+      expect(carsResponseError).toEqual(reasonValue);
+    });
+
+    it('should invoke GET car by id without error', function () {
+      var respValue;
+
+      $httpBackend.expectGET(API.CAR.replace(':carId', id)).respond(200, carResponseSuccess);
+      cars.getById(id).then(function(resp) {
+        respValue = resp.data;
+      });
+
+      $httpBackend.flush();
+
+      expect(carResponseSuccess).toEqual(respValue);
+    });
+
+    it('should invoke GET car by id with error', function () {
+      var reasonValue;
+
+      $httpBackend.expectGET(API.CAR.replace(':carId', id)).respond(400, carsResponseError);
+      cars.getById(id).then(function() {}, function(reason) {
+        reasonValue = reason.data;
+      });
+
+      $httpBackend.flush();
+
+      expect(carsResponseError).toEqual(reasonValue);
+    });
+
+  });
+
+  afterEach(function() {
+    $httpBackend.verifyNoOutstandingExpectation();
+    $httpBackend.verifyNoOutstandingRequest();
+  });
+
+});
diff --git a/angularjs/showcase/src/showcase/app/cars/cars.service.spec.js b/angularjs/showcase/src/showcase/app/cars/cars.service.spec.js
deleted file mode 100644 (file)
index 4c7f454..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-describe('app.cars', function() {
-  'use strict';
-
-  var $httpBackend;
-  var $log;
-  var id = 666;
-  var carResponseSuccess = {
-    content: 'Car: false',
-    id: id
-  };
-  var carsResponseSuccess = [
-    carResponseSuccess
-  ];
-  var carsResponseError = 'Error: connect ECONNREFUSED';
-  var cars;
-  var API;
-
-  beforeEach(function() {
-    module('app.cars');
-
-    inject(function(_$httpBackend_, _$log_, _cars_, _API_) {
-      $httpBackend = _$httpBackend_;
-      $log = _$log_;
-      cars = _cars_;
-      API = _API_;
-    });
-  });
-
-  describe('cars service', function () {
-
-    it('should invoke GET all cars without error', function () {
-      var respValue;
-
-      $httpBackend.expectGET(API.CARS).respond(200, carsResponseSuccess);
-      cars.getAll().then(function(resp) {
-        respValue = resp;
-      });
-      $httpBackend.flush();
-
-      expect(carsResponseSuccess).toEqual(respValue);
-    });
-
-    it('should invoke GET all cars with error', function () {
-      var reasonValue;
-
-      $httpBackend.expectGET(API.CARS).respond(400, carsResponseError);
-      cars.getAll().then(function() {}, function(reason) {
-        reasonValue = reason;
-      });
-      $httpBackend.flush();
-
-      expect(carsResponseError).toEqual(reasonValue);
-    });
-
-    it('should invoke GET car by id without error', function () {
-      var respValue;
-
-      $httpBackend.expectGET(API.CAR.replace(':carId', id)).respond(200, carResponseSuccess);
-      cars.getById(id).then(function(resp) {
-        respValue = resp.data;
-      });
-
-      $httpBackend.flush();
-
-      expect(carResponseSuccess).toEqual(respValue);
-    });
-
-    it('should invoke GET car by id with error', function () {
-      var reasonValue;
-
-      $httpBackend.expectGET(API.CAR.replace(':carId', id)).respond(400, carsResponseError);
-      cars.getById(id).then(function() {}, function(reason) {
-        reasonValue = reason.data;
-      });
-
-      $httpBackend.flush();
-
-      expect(carsResponseError).toEqual(reasonValue);
-    });
-
-  });
-
-  afterEach(function() {
-    $httpBackend.verifyNoOutstandingExpectation();
-    $httpBackend.verifyNoOutstandingRequest();
-  });
-
-});
diff --git a/angularjs/showcase/src/showcase/app/users/users-child.controller.js.spec b/angularjs/showcase/src/showcase/app/users/users-child.controller.js.spec
new file mode 100644 (file)
index 0000000..2b5faeb
--- /dev/null
@@ -0,0 +1,97 @@
+describe('app.users', function() {
+  'use strict';
+
+  var valueForChildControllers = {
+    variable: 'This is a variable from UsersController',
+    value: 'Hello child controller'
+  };
+  var usersController = {
+    toBeCalledFromChildControllers: function() {
+      return valueForChildControllers;
+    }
+  };
+  var $rootScope;
+  var $scope;
+  var USERS;
+  var UsersChildController;
+
+  beforeEach(function() {
+    module('app.users');
+
+    inject(function($controller, _$rootScope_, _USERS_) {
+      $rootScope = _$rootScope_;
+      USERS = _USERS_;
+      $scope = $rootScope.$new();
+
+      $scope.usersController = usersController;
+      spyOn($scope, '$emit');
+      spyOn($rootScope, '$broadcast');
+      jasmine.createSpy($scope, '$scope.$broadcast');
+      spyOn($scope.usersController, 'toBeCalledFromChildControllers')
+        .and.callThrough();
+      UsersChildController = $controller('UsersChildController', {
+        $rootScope: $rootScope,
+        $scope: $scope,
+        USERS: _USERS_
+      });
+    });
+  });
+
+  describe('UsersChildController', function () {
+
+    it('should be created successfully', function () {
+      expect(UsersChildController).toBeDefined();
+
+      expect($scope.usersController.toBeCalledFromChildControllers).toHaveBeenCalled();
+      expect(UsersChildController.valueForChildControllers).toEqual(valueForChildControllers);
+    });
+
+    it('should be called $scope.$emit', function () {
+      var emitFact = {
+        title: 'Snake and Scarlett',
+        fact: 'it is canon'
+      };
+
+      UsersChildController.getEmit();
+
+      expect($scope.$emit).toHaveBeenCalledWith(USERS.SCOPE.EMIT_FACT, emitFact);
+    });
+
+    it('should be assigned broadcastUser', function () {
+      var rootScopeBroadcastUser = {
+        name: 'Snake',
+        lastName: 'Eyes',
+        city: 'classified'
+      };
+      var event = {
+        name: USERS.ROOTSCOPE.BROADCAST
+      };
+
+      UsersChildController.usersChildOnScopeBroadcast(event, rootScopeBroadcastUser);
+
+      expect(UsersChildController.broadcastUser).toEqual(rootScopeBroadcastUser);
+    });
+
+    it('should be called $rootScope.$broadcast', function () {
+      var scopeBroadcastToSecondChild = {
+        name: 'UsersChild To UsersSecondChild',
+        lastName: 'scope broadcasting to UsersSecondChild from UserChild',
+        city: 'UserChild'
+      };
+      var rootScopeBroadcastToSecondChild = {
+        name: 'UsersChild To UsersSecondChild',
+        lastName: 'rootscope broadcasting to UsersSecondChild from UserChild',
+        city: 'UserChild'
+      };
+
+      UsersChildController.broadcastToSencondChild();
+
+      expect($rootScope.$broadcast).toHaveBeenCalledWith(
+        USERS.ROOTSCOPE.BROADCAST_TO_SENCONDCHILD, rootScopeBroadcastToSecondChild);
+      expect($scope.$broadcast).toHaveBeenCalledWith(
+        USERS.SCOPE.BROADCAST_TO_SENCONDCHILD, scopeBroadcastToSecondChild);
+    });
+
+  });
+
+});
diff --git a/angularjs/showcase/src/showcase/app/users/users-child.controller.spec.js b/angularjs/showcase/src/showcase/app/users/users-child.controller.spec.js
deleted file mode 100644 (file)
index 2b5faeb..0000000
+++ /dev/null
@@ -1,97 +0,0 @@
-describe('app.users', function() {
-  'use strict';
-
-  var valueForChildControllers = {
-    variable: 'This is a variable from UsersController',
-    value: 'Hello child controller'
-  };
-  var usersController = {
-    toBeCalledFromChildControllers: function() {
-      return valueForChildControllers;
-    }
-  };
-  var $rootScope;
-  var $scope;
-  var USERS;
-  var UsersChildController;
-
-  beforeEach(function() {
-    module('app.users');
-
-    inject(function($controller, _$rootScope_, _USERS_) {
-      $rootScope = _$rootScope_;
-      USERS = _USERS_;
-      $scope = $rootScope.$new();
-
-      $scope.usersController = usersController;
-      spyOn($scope, '$emit');
-      spyOn($rootScope, '$broadcast');
-      jasmine.createSpy($scope, '$scope.$broadcast');
-      spyOn($scope.usersController, 'toBeCalledFromChildControllers')
-        .and.callThrough();
-      UsersChildController = $controller('UsersChildController', {
-        $rootScope: $rootScope,
-        $scope: $scope,
-        USERS: _USERS_
-      });
-    });
-  });
-
-  describe('UsersChildController', function () {
-
-    it('should be created successfully', function () {
-      expect(UsersChildController).toBeDefined();
-
-      expect($scope.usersController.toBeCalledFromChildControllers).toHaveBeenCalled();
-      expect(UsersChildController.valueForChildControllers).toEqual(valueForChildControllers);
-    });
-
-    it('should be called $scope.$emit', function () {
-      var emitFact = {
-        title: 'Snake and Scarlett',
-        fact: 'it is canon'
-      };
-
-      UsersChildController.getEmit();
-
-      expect($scope.$emit).toHaveBeenCalledWith(USERS.SCOPE.EMIT_FACT, emitFact);
-    });
-
-    it('should be assigned broadcastUser', function () {
-      var rootScopeBroadcastUser = {
-        name: 'Snake',
-        lastName: 'Eyes',
-        city: 'classified'
-      };
-      var event = {
-        name: USERS.ROOTSCOPE.BROADCAST
-      };
-
-      UsersChildController.usersChildOnScopeBroadcast(event, rootScopeBroadcastUser);
-
-      expect(UsersChildController.broadcastUser).toEqual(rootScopeBroadcastUser);
-    });
-
-    it('should be called $rootScope.$broadcast', function () {
-      var scopeBroadcastToSecondChild = {
-        name: 'UsersChild To UsersSecondChild',
-        lastName: 'scope broadcasting to UsersSecondChild from UserChild',
-        city: 'UserChild'
-      };
-      var rootScopeBroadcastToSecondChild = {
-        name: 'UsersChild To UsersSecondChild',
-        lastName: 'rootscope broadcasting to UsersSecondChild from UserChild',
-        city: 'UserChild'
-      };
-
-      UsersChildController.broadcastToSencondChild();
-
-      expect($rootScope.$broadcast).toHaveBeenCalledWith(
-        USERS.ROOTSCOPE.BROADCAST_TO_SENCONDCHILD, rootScopeBroadcastToSecondChild);
-      expect($scope.$broadcast).toHaveBeenCalledWith(
-        USERS.SCOPE.BROADCAST_TO_SENCONDCHILD, scopeBroadcastToSecondChild);
-    });
-
-  });
-
-});
diff --git a/angularjs/showcase/src/showcase/app/users/users-second-child.controller.js.spec b/angularjs/showcase/src/showcase/app/users/users-second-child.controller.js.spec
new file mode 100644 (file)
index 0000000..0b6f18d
--- /dev/null
@@ -0,0 +1,63 @@
+describe('app.users', function() {
+  'use strict';
+
+  var $rootScope;
+  var $scope;
+  var USERS;
+  var UsersSecondChildController;
+
+  beforeEach(function() {
+    module('app.users');
+
+    inject(function($controller, _$rootScope_, _USERS_) {
+      $rootScope = _$rootScope_;
+      USERS = _USERS_;
+      $scope = $rootScope.$new();
+
+      spyOn($scope, '$emit');
+      UsersSecondChildController = $controller('UsersSecondChildController', {
+        $rootScope: $rootScope,
+        $scope: $scope,
+        USERS: _USERS_
+      });
+    });
+  });
+
+  describe('UsersSecondChildController', function () {
+
+    it('should be created successfully', function () {
+      expect(UsersSecondChildController).toBeDefined();
+    });
+
+    it('should be assigned rootScopeBroadcastUser', function () {
+      var rootScopeBroadcastUser = {
+        name: 'UsersChild To UsersSecondChild',
+        lastName: 'rootscope broadcasting to UsersSecondChild from UserChild',
+        city: 'UserChild'
+      };
+      var event = {
+        name: USERS.ROOTSCOPE.BROADCAST_TO_SENCONDCHILD
+      };
+
+      UsersSecondChildController.usersSecondChildOnRootScopeBroadcast(event, rootScopeBroadcastUser);
+
+      expect(UsersSecondChildController.rootScopeBroadcastUser).toEqual(rootScopeBroadcastUser);
+    });
+
+    it('should be assigned broadcastUser', function () {
+      var scopeBroadcastUser = {
+        name: 'UsersChild To UsersSecondChild',
+        lastName: 'rootscope broadcasting to UsersSecondChild from UserChild',
+        city: 'UserChild'
+      };
+      var event = {
+        name: USERS.SCOPE.BROADCAST_TO_SENCONDCHILD
+      };
+
+      UsersSecondChildController.usersSecondChildOnScopeBroadcast(event, scopeBroadcastUser);
+
+      expect(UsersSecondChildController.scopeBroadcastUser).toEqual(scopeBroadcastUser);
+    });
+  });
+
+});
diff --git a/angularjs/showcase/src/showcase/app/users/users-second-child.controller.spec.js b/angularjs/showcase/src/showcase/app/users/users-second-child.controller.spec.js
deleted file mode 100644 (file)
index 0b6f18d..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-describe('app.users', function() {
-  'use strict';
-
-  var $rootScope;
-  var $scope;
-  var USERS;
-  var UsersSecondChildController;
-
-  beforeEach(function() {
-    module('app.users');
-
-    inject(function($controller, _$rootScope_, _USERS_) {
-      $rootScope = _$rootScope_;
-      USERS = _USERS_;
-      $scope = $rootScope.$new();
-
-      spyOn($scope, '$emit');
-      UsersSecondChildController = $controller('UsersSecondChildController', {
-        $rootScope: $rootScope,
-        $scope: $scope,
-        USERS: _USERS_
-      });
-    });
-  });
-
-  describe('UsersSecondChildController', function () {
-
-    it('should be created successfully', function () {
-      expect(UsersSecondChildController).toBeDefined();
-    });
-
-    it('should be assigned rootScopeBroadcastUser', function () {
-      var rootScopeBroadcastUser = {
-        name: 'UsersChild To UsersSecondChild',
-        lastName: 'rootscope broadcasting to UsersSecondChild from UserChild',
-        city: 'UserChild'
-      };
-      var event = {
-        name: USERS.ROOTSCOPE.BROADCAST_TO_SENCONDCHILD
-      };
-
-      UsersSecondChildController.usersSecondChildOnRootScopeBroadcast(event, rootScopeBroadcastUser);
-
-      expect(UsersSecondChildController.rootScopeBroadcastUser).toEqual(rootScopeBroadcastUser);
-    });
-
-    it('should be assigned broadcastUser', function () {
-      var scopeBroadcastUser = {
-        name: 'UsersChild To UsersSecondChild',
-        lastName: 'rootscope broadcasting to UsersSecondChild from UserChild',
-        city: 'UserChild'
-      };
-      var event = {
-        name: USERS.SCOPE.BROADCAST_TO_SENCONDCHILD
-      };
-
-      UsersSecondChildController.usersSecondChildOnScopeBroadcast(event, scopeBroadcastUser);
-
-      expect(UsersSecondChildController.scopeBroadcastUser).toEqual(scopeBroadcastUser);
-    });
-  });
-
-});
diff --git a/angularjs/showcase/src/showcase/app/users/users.controller.js.spec b/angularjs/showcase/src/showcase/app/users/users.controller.js.spec
new file mode 100644 (file)
index 0000000..6919a11
--- /dev/null
@@ -0,0 +1,72 @@
+describe('app.users', function() {
+  'use strict';
+
+  var $rootScope;
+  var $scope;
+  var USERS;
+  var UsersController;
+
+  beforeEach(function() {
+    module('app.users');
+
+    inject(function($controller, _$rootScope_, _USERS_) {
+      $rootScope = _$rootScope_;
+      USERS = _USERS_;
+      $scope = $rootScope.$new();
+
+      spyOn($rootScope, '$broadcast');
+      jasmine.createSpy($scope, '$scope.$broadcast');
+      UsersController = $controller('UsersController', {
+        $rootScope: $rootScope,
+        $scope: $scope,
+        USERS: _USERS_
+      });
+    });
+  });
+
+  describe('UsersController', function () {
+
+    it('should be created successfully', function () {
+      expect(UsersController).toBeDefined();
+    });
+
+    it('should be called $rootScope.$broadcast', function () {
+      var rootScopeBroadcastUser = {
+        name: 'Snake',
+        lastName: 'Eyes',
+        city: 'classified'
+      };
+
+      UsersController.getRootScopeBroadcast();
+
+      expect($rootScope.$broadcast).toHaveBeenCalledWith(USERS.ROOTSCOPE.BROADCAST, rootScopeBroadcastUser);
+    });
+
+    it('should be called $scope.$broadcast', function () {
+      var scopeBroadcastUser = {
+        name: 'Shana',
+        lastName: 'M. O\'Hara',
+        city: 'Atlanta'
+      };
+
+      UsersController.getScopeBroadcast();
+
+      expect($scope.$broadcast).toHaveBeenCalledWith(USERS.ROOTSCOPE.BROADCAST, scopeBroadcastUser);
+    });
+
+    it('should be assigned emitFact', function () {
+      var emitFact = {
+        title: 'Snake and Scarlett',
+        fact: 'it is canon'
+      };
+      var event = {
+        name: 'USERS_SCOPE_EMIT_FACT'
+      };
+
+      UsersController.usersOnEmitFact(event, emitFact);
+
+      expect(UsersController.emitFact).toEqual(emitFact);
+    });
+  });
+
+});
diff --git a/angularjs/showcase/src/showcase/app/users/users.controller.spec.js b/angularjs/showcase/src/showcase/app/users/users.controller.spec.js
deleted file mode 100644 (file)
index 6919a11..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-describe('app.users', function() {
-  'use strict';
-
-  var $rootScope;
-  var $scope;
-  var USERS;
-  var UsersController;
-
-  beforeEach(function() {
-    module('app.users');
-
-    inject(function($controller, _$rootScope_, _USERS_) {
-      $rootScope = _$rootScope_;
-      USERS = _USERS_;
-      $scope = $rootScope.$new();
-
-      spyOn($rootScope, '$broadcast');
-      jasmine.createSpy($scope, '$scope.$broadcast');
-      UsersController = $controller('UsersController', {
-        $rootScope: $rootScope,
-        $scope: $scope,
-        USERS: _USERS_
-      });
-    });
-  });
-
-  describe('UsersController', function () {
-
-    it('should be created successfully', function () {
-      expect(UsersController).toBeDefined();
-    });
-
-    it('should be called $rootScope.$broadcast', function () {
-      var rootScopeBroadcastUser = {
-        name: 'Snake',
-        lastName: 'Eyes',
-        city: 'classified'
-      };
-
-      UsersController.getRootScopeBroadcast();
-
-      expect($rootScope.$broadcast).toHaveBeenCalledWith(USERS.ROOTSCOPE.BROADCAST, rootScopeBroadcastUser);
-    });
-
-    it('should be called $scope.$broadcast', function () {
-      var scopeBroadcastUser = {
-        name: 'Shana',
-        lastName: 'M. O\'Hara',
-        city: 'Atlanta'
-      };
-
-      UsersController.getScopeBroadcast();
-
-      expect($scope.$broadcast).toHaveBeenCalledWith(USERS.ROOTSCOPE.BROADCAST, scopeBroadcastUser);
-    });
-
-    it('should be assigned emitFact', function () {
-      var emitFact = {
-        title: 'Snake and Scarlett',
-        fact: 'it is canon'
-      };
-      var event = {
-        name: 'USERS_SCOPE_EMIT_FACT'
-      };
-
-      UsersController.usersOnEmitFact(event, emitFact);
-
-      expect(UsersController.emitFact).toEqual(emitFact);
-    });
-  });
-
-});
diff --git a/angularjs/showcase/src/showcase/app/users/users.route.js.spec b/angularjs/showcase/src/showcase/app/users/users.route.js.spec
new file mode 100644 (file)
index 0000000..0131620
--- /dev/null
@@ -0,0 +1,24 @@
+describe('app.users', function() {
+  'use strict';
+
+  describe('state', function() {
+    var view = {
+      users: 'app/users/users.html'
+    };
+    var $state;
+
+    beforeEach(function() {
+      module('app.users');
+
+      inject(function(_$state_) {
+        $state = _$state_;
+      });
+    });
+
+    it('should map /users route to users View template', function() {
+      expect($state.get('users').templateUrl).toEqual(view.users);
+    });
+
+  });
+
+});
diff --git a/angularjs/showcase/src/showcase/app/users/users.route.spec.js b/angularjs/showcase/src/showcase/app/users/users.route.spec.js
deleted file mode 100644 (file)
index 0131620..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-describe('app.users', function() {
-  'use strict';
-
-  describe('state', function() {
-    var view = {
-      users: 'app/users/users.html'
-    };
-    var $state;
-
-    beforeEach(function() {
-      module('app.users');
-
-      inject(function(_$state_) {
-        $state = _$state_;
-      });
-    });
-
-    it('should map /users route to users View template', function() {
-      expect($state.get('users').templateUrl).toEqual(view.users);
-    });
-
-  });
-
-});
diff --git a/angularjs/showcase/src/showcase/app/welcome/welcome-account.controller.js.spec b/angularjs/showcase/src/showcase/app/welcome/welcome-account.controller.js.spec
new file mode 100644 (file)
index 0000000..d015224
--- /dev/null
@@ -0,0 +1,74 @@
+describe('app.welcome', function() {
+  'use strict';
+
+  beforeEach(function() {
+    module('app.welcome');
+  });
+
+  describe('WelcomeAccountController', function () {
+
+    it('should fill yourChoice field', function () {
+      var fullName = 'Gustavo Martin';
+      var expected = fullName + ' / ' + 'This field would be the user\'s choice';
+      var birthDate = {
+        city: 'classified',
+        birthDate: 'private'
+      };
+      var WelcomeAccountController;
+
+      inject(function(_$rootScope_, $controller) {
+        var $scope = _$rootScope_.$new();
+        WelcomeAccountController = $controller(
+          'WelcomeAccountController',
+          {$scope: $scope},
+          {fullName: fullName}
+        );
+      });
+
+      // Jasmine toEqual code:
+      //getJasmineRequireObj().toEqual = function() {
+      //
+      //  function toEqual(util, customEqualityTesters) {
+      //    customEqualityTesters = customEqualityTesters || [];
+      //
+      //    return {
+      //      compare: function(actual, expected) {
+      //        var result = {
+      //          pass: false
+      //        };
+      //
+      //        result.pass = util.equals(actual, expected, customEqualityTesters);
+      //
+      //        return result;
+      //      }
+      //    };
+      //  }
+      expect(expected).toEqual(WelcomeAccountController.yourChoice);
+
+      // toBe works because I am testing strings and it seems as if the virtual machine
+      // is using the same pointer for strings which are the same. Even if they are created from
+      // other strings? I looks like that. Because in this spec I have constant strings but in WelcomeAccountController
+      // I don't have a constant string and toBe keeps working...
+      // toBe is the same as testing: object === someOtherObject
+
+      // Jasmine toBe code:
+      //getJasmineRequireObj().toBe = function() {
+      //  function toBe() {
+      //    return {
+      //      compare: function(actual, expected) {
+      //        return {
+      //          pass: actual === expected
+      //        };
+      //      }
+      //    };
+      //  }
+      expect(expected).toBe(WelcomeAccountController.yourChoice);
+
+      expect(birthDate).toEqual(WelcomeAccountController.birthDate);
+      // toBe in this case doesn't work because I am testing objects and they have different pointers.
+      expect(birthDate).not.toBe(WelcomeAccountController.birthDate);
+    });
+
+  });
+
+});
diff --git a/angularjs/showcase/src/showcase/app/welcome/welcome-account.controller.spec.js b/angularjs/showcase/src/showcase/app/welcome/welcome-account.controller.spec.js
deleted file mode 100644 (file)
index d015224..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-describe('app.welcome', function() {
-  'use strict';
-
-  beforeEach(function() {
-    module('app.welcome');
-  });
-
-  describe('WelcomeAccountController', function () {
-
-    it('should fill yourChoice field', function () {
-      var fullName = 'Gustavo Martin';
-      var expected = fullName + ' / ' + 'This field would be the user\'s choice';
-      var birthDate = {
-        city: 'classified',
-        birthDate: 'private'
-      };
-      var WelcomeAccountController;
-
-      inject(function(_$rootScope_, $controller) {
-        var $scope = _$rootScope_.$new();
-        WelcomeAccountController = $controller(
-          'WelcomeAccountController',
-          {$scope: $scope},
-          {fullName: fullName}
-        );
-      });
-
-      // Jasmine toEqual code:
-      //getJasmineRequireObj().toEqual = function() {
-      //
-      //  function toEqual(util, customEqualityTesters) {
-      //    customEqualityTesters = customEqualityTesters || [];
-      //
-      //    return {
-      //      compare: function(actual, expected) {
-      //        var result = {
-      //          pass: false
-      //        };
-      //
-      //        result.pass = util.equals(actual, expected, customEqualityTesters);
-      //
-      //        return result;
-      //      }
-      //    };
-      //  }
-      expect(expected).toEqual(WelcomeAccountController.yourChoice);
-
-      // toBe works because I am testing strings and it seems as if the virtual machine
-      // is using the same pointer for strings which are the same. Even if they are created from
-      // other strings? I looks like that. Because in this spec I have constant strings but in WelcomeAccountController
-      // I don't have a constant string and toBe keeps working...
-      // toBe is the same as testing: object === someOtherObject
-
-      // Jasmine toBe code:
-      //getJasmineRequireObj().toBe = function() {
-      //  function toBe() {
-      //    return {
-      //      compare: function(actual, expected) {
-      //        return {
-      //          pass: actual === expected
-      //        };
-      //      }
-      //    };
-      //  }
-      expect(expected).toBe(WelcomeAccountController.yourChoice);
-
-      expect(birthDate).toEqual(WelcomeAccountController.birthDate);
-      // toBe in this case doesn't work because I am testing objects and they have different pointers.
-      expect(birthDate).not.toBe(WelcomeAccountController.birthDate);
-    });
-
-  });
-
-});
diff --git a/angularjs/showcase/src/showcase/app/welcome/welcome-account.directive.js.spec b/angularjs/showcase/src/showcase/app/welcome/welcome-account.directive.js.spec
new file mode 100644 (file)
index 0000000..fbfb4fa
--- /dev/null
@@ -0,0 +1,35 @@
+(function() {
+  'use strict';
+
+  describe('welcomeAccountDirective', function() {
+    var $compile;
+    var $rootScope;
+    var template;
+
+    beforeEach(module('app.welcome'));
+
+    beforeEach(inject(function(_$compile_, _$rootScope_) {
+      $compile = _$compile_;
+      $rootScope = _$rootScope_;
+      template = '<welcome-account-directive full-name="example.fullName"></welcome-account-directive>';
+    }));
+
+    it('should assign min value 3', function() {
+      var $scope = $rootScope.$new();
+      var element;
+      var account;
+      $scope.example = {
+        fullName: 'Snake Eyes'
+      };
+
+      element = $compile(template)($scope);
+      $scope.$digest();
+      account = element.find('div.account');
+
+      expect(account.length).toBe(2);
+      expect(account.eq(0).text()).toBe('fullName=Snake Eyes');
+      expect(account.eq(1).text()).toBe('yourChoice=Snake Eyes / This field would be the user\'s choice');
+    });
+  });
+
+}());
diff --git a/angularjs/showcase/src/showcase/app/welcome/welcome-account.directive.spec.js b/angularjs/showcase/src/showcase/app/welcome/welcome-account.directive.spec.js
deleted file mode 100644 (file)
index fbfb4fa..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-(function() {
-  'use strict';
-
-  describe('welcomeAccountDirective', function() {
-    var $compile;
-    var $rootScope;
-    var template;
-
-    beforeEach(module('app.welcome'));
-
-    beforeEach(inject(function(_$compile_, _$rootScope_) {
-      $compile = _$compile_;
-      $rootScope = _$rootScope_;
-      template = '<welcome-account-directive full-name="example.fullName"></welcome-account-directive>';
-    }));
-
-    it('should assign min value 3', function() {
-      var $scope = $rootScope.$new();
-      var element;
-      var account;
-      $scope.example = {
-        fullName: 'Snake Eyes'
-      };
-
-      element = $compile(template)($scope);
-      $scope.$digest();
-      account = element.find('div.account');
-
-      expect(account.length).toBe(2);
-      expect(account.eq(0).text()).toBe('fullName=Snake Eyes');
-      expect(account.eq(1).text()).toBe('yourChoice=Snake Eyes / This field would be the user\'s choice');
-    });
-  });
-
-}());
diff --git a/angularjs/showcase/src/showcase/app/welcome/welcome.controller.js.spec b/angularjs/showcase/src/showcase/app/welcome/welcome.controller.js.spec
new file mode 100644 (file)
index 0000000..f6be9eb
--- /dev/null
@@ -0,0 +1,24 @@
+describe('app.welcome', function() {
+  'use strict';
+
+  var WelcomeController;
+  var $scope;
+
+  beforeEach(function() {
+    module('app.welcome');
+
+    inject(function($controller, _$rootScope_) {
+      $scope = _$rootScope_.$new();
+      $scope.hello = 'Hello World';
+      WelcomeController = $controller('WelcomeController', {$scope: $scope});
+    });
+  });
+
+  describe('WelcomeController', function () {
+
+    it('should be created successfully', function () {
+      expect(WelcomeController).toBeDefined();
+    });
+  });
+
+});
diff --git a/angularjs/showcase/src/showcase/app/welcome/welcome.controller.spec.js b/angularjs/showcase/src/showcase/app/welcome/welcome.controller.spec.js
deleted file mode 100644 (file)
index f6be9eb..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-describe('app.welcome', function() {
-  'use strict';
-
-  var WelcomeController;
-  var $scope;
-
-  beforeEach(function() {
-    module('app.welcome');
-
-    inject(function($controller, _$rootScope_) {
-      $scope = _$rootScope_.$new();
-      $scope.hello = 'Hello World';
-      WelcomeController = $controller('WelcomeController', {$scope: $scope});
-    });
-  });
-
-  describe('WelcomeController', function () {
-
-    it('should be created successfully', function () {
-      expect(WelcomeController).toBeDefined();
-    });
-  });
-
-});
diff --git a/angularjs/showcase/src/showcase/app/welcome/welcome.route.js.spec b/angularjs/showcase/src/showcase/app/welcome/welcome.route.js.spec
new file mode 100644 (file)
index 0000000..7478589
--- /dev/null
@@ -0,0 +1,24 @@
+describe('app.welcome', function() {
+  'use strict';
+
+  describe('state', function() {
+    var view = {
+      welcome: 'app/welcome/welcome.html'
+    };
+    var $state;
+
+    beforeEach(function() {
+      module('app.welcome');
+
+      inject(function(_$state_) {
+        $state = _$state_;
+      });
+    });
+
+    it('should map /welcome route to welcome View template', function() {
+      expect($state.get('welcome').templateUrl).toEqual(view.welcome);
+    });
+
+  });
+
+});
diff --git a/angularjs/showcase/src/showcase/app/welcome/welcome.route.spec.js b/angularjs/showcase/src/showcase/app/welcome/welcome.route.spec.js
deleted file mode 100644 (file)
index 7478589..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-describe('app.welcome', function() {
-  'use strict';
-
-  describe('state', function() {
-    var view = {
-      welcome: 'app/welcome/welcome.html'
-    };
-    var $state;
-
-    beforeEach(function() {
-      module('app.welcome');
-
-      inject(function(_$state_) {
-        $state = _$state_;
-      });
-    });
-
-    it('should map /welcome route to welcome View template', function() {
-      expect($state.get('welcome').templateUrl).toEqual(view.welcome);
-    });
-
-  });
-
-});
diff --git a/angularjs/showcase/src/showcase/app/widgets/example-controller-as.directive.js.spec b/angularjs/showcase/src/showcase/app/widgets/example-controller-as.directive.js.spec
new file mode 100644 (file)
index 0000000..7efccf9
--- /dev/null
@@ -0,0 +1,37 @@
+(function() {
+  'use strict';
+
+  describe('exampleControllerAsDirective', function() {
+    var $compile;
+    var $rootScope;
+    var template;
+
+    beforeEach(module('app.widgets'));
+
+    beforeEach(inject(function(_$compile_, _$rootScope_) {
+      $compile = _$compile_;
+      $rootScope = _$rootScope_;
+      template = '<controller-as-directive>';
+    }));
+
+    it('should assign min value 3', function() {
+      var $scope;
+      var element;
+      var vm;
+
+      $scope = $rootScope.$new();
+      // IN THE REAL WORLD, BETTER DECLARE THE CONTROLLER RELATED TO MY DIRECTIVE IN A DIFFERENT FILE AND
+      // TEST THE CONTROLLER WITH ITS OWN SPEC!!!!!
+      // see: http://stackoverflow.com/a/15314876
+      element = $compile(template)($scope);
+      $scope.$digest();
+
+      vm = element.controller('controllerAsDirective');
+
+      expect(vm.min).toEqual(3);
+
+    });
+
+  });
+
+}());
diff --git a/angularjs/showcase/src/showcase/app/widgets/example-controller-as.directive.spec.js b/angularjs/showcase/src/showcase/app/widgets/example-controller-as.directive.spec.js
deleted file mode 100644 (file)
index 7efccf9..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-(function() {
-  'use strict';
-
-  describe('exampleControllerAsDirective', function() {
-    var $compile;
-    var $rootScope;
-    var template;
-
-    beforeEach(module('app.widgets'));
-
-    beforeEach(inject(function(_$compile_, _$rootScope_) {
-      $compile = _$compile_;
-      $rootScope = _$rootScope_;
-      template = '<controller-as-directive>';
-    }));
-
-    it('should assign min value 3', function() {
-      var $scope;
-      var element;
-      var vm;
-
-      $scope = $rootScope.$new();
-      // IN THE REAL WORLD, BETTER DECLARE THE CONTROLLER RELATED TO MY DIRECTIVE IN A DIFFERENT FILE AND
-      // TEST THE CONTROLLER WITH ITS OWN SPEC!!!!!
-      // see: http://stackoverflow.com/a/15314876
-      element = $compile(template)($scope);
-      $scope.$digest();
-
-      vm = element.controller('controllerAsDirective');
-
-      expect(vm.min).toEqual(3);
-
-    });
-
-  });
-
-}());