From 9045997a1e73b587db3ac479340297b3fa06d628 Mon Sep 17 00:00:00 2001 From: karim hamidou Date: Sat, 19 Oct 2013 10:55:27 +0200 Subject: [PATCH] make tests pass --- src/front/test/unit/controllers.spec.js | 20 ++++++++++++-------- src/front/test/unit/services.spec.js | 10 ++++------ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/front/test/unit/controllers.spec.js b/src/front/test/unit/controllers.spec.js index 185a26d..f81477e 100644 --- a/src/front/test/unit/controllers.spec.js +++ b/src/front/test/unit/controllers.spec.js @@ -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() { diff --git a/src/front/test/unit/services.spec.js b/src/front/test/unit/services.spec.js index 2425dc4..ee0ce68 100644 --- a/src/front/test/unit/services.spec.js +++ b/src/front/test/unit/services.spec.js @@ -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() { + })); - }); }); -- 2.43.0