X-Git-Url: http://git.rot13.org/?p=angular-drzb;a=blobdiff_plain;f=test%2Funit%2FcontrollersSpec.js;fp=test%2Funit%2FcontrollersSpec.js;h=e7eb996fc65d3923f6add891a433b50e7a3e7f7d;hp=e0ad327723bbeb52da4ea0e3f6c026990b5e8212;hb=da59244f1f6246d809a2af9891475e855b5a1f02;hpb=39e4203cab6bea4279c604afb76a18a9ec44ef8e diff --git a/test/unit/controllersSpec.js b/test/unit/controllersSpec.js index e0ad327..e7eb996 100644 --- a/test/unit/controllersSpec.js +++ b/test/unit/controllersSpec.js @@ -73,3 +73,35 @@ describe('ListCtrl', function(){ expect( scope.ValidStates ).toBeTruthy(); }); }); + + +describe('AuthorsCtrl', function(){ + var scope, $httpBackend; + + beforeEach(module('myApp')); + + beforeEach(inject(function($injector) { + $httpBackend = $injector.get('$httpBackend'); + $httpBackend.whenJSONP(/authors/).passThrough(); + })); + afterEach(function() { + $httpBackend.verifyNoOutstandingExpectation(); + $httpBackend.verifyNoOutstandingRequest(); + }); + + beforeEach(inject(function($rootScope, $controller){ + scope = $rootScope.$new(); + var ctrl = $controller(AuthorsCtrl, { $scope: scope } ); + })); + + + it('ready', function() { + $httpBackend.flush(); + expect( scope.ready ).toBe( true ); + }); + + it('data', function() { + $httpBackend.flush(); + expect( scope.data ).toBeTruthy(); + }); +});