]> khamidou — GitHub mirrors - kite.git/commitdiff
make tests pass
authorkarim hamidou <khamidou@gmail.com>
Sat, 19 Oct 2013 08:55:27 +0000 (10:55 +0200)
committerkarim hamidou <khamidou@gmail.com>
Sat, 19 Oct 2013 08:55:27 +0000 (10:55 +0200)
src/front/test/unit/controllers.spec.js
src/front/test/unit/services.spec.js

index 185a26d30e0c7c84dc03a5b4dd6c9d37f487e944..f81477eb96fd61cf197055ae77b2b1f33736650b 100644 (file)
@@ -3,17 +3,21 @@
 /* jasmine specs for controllers go here */
 
 describe('controllers', function(){
-    beforeEach(module('KiteMail.controllers'));
+    beforeEach(
+    function() {
+        module('KiteMail.controllers');
+    });
 
     
     describe('MailsListController', function() {
-        it('should do an ajax request to query mails', inject(function($injector) {
-            var $httpBackend = $injector.get('$httpBackend');
-            $httpBackend.expectGET('/karim/mail', 200);
-
-            var $rootScope = $injector.get('$rootScope');
-            var ctrl = $injector.get("MailsListController", {$scope: $rootScope})
-            this.$httpBackend.flush();
+        it('should call Email.query service to query mails', inject(function($controller, $rootScope) {
+            var locals = {
+                $scope: $rootScope,
+                Emails: jasmine.createSpyObj('Emails', ['query']),
+            };
+            
+            var ctrl = $controller("MailsListController", locals)
+            expect(locals.Emails.query).toHaveBeenCalled();
         }));
 
         it('should ....', inject(function() {
index 2425dc4f49cc7eb8f83be8cb7bbfd6658b67a68f..ee0ce68e6fbd7705bc4c0613ea545b2ccae9fb25 100644 (file)
@@ -3,12 +3,10 @@
 /* jasmine specs for services go here */
 
 describe('service', function() {
-  beforeEach(module('KiteMail.services'));
+    beforeEach(module('KiteMail.services'));
 
-
-  describe('version', function() {
-    it('should return current version', inject(function(version) {
-      expect(version).toEqual('0.1');
+    describe('EmailsService', function() {
+    it('should do an ajax request to get the list of services', inject(function() {
+        
     }));
-  });
 });