Created
November 19, 2014 07:30
-
-
Save KamilLelonek/0db2d2a1eabdb5ccdde9 to your computer and use it in GitHub Desktop.
Testing ExtensionsModule
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe 'ExtensionsModule', -> | |
beforeEach module 'StudentHunter.Constants' | |
beforeEach module 'StudentHunter.ExtensionsModule' | |
beforeEach module 'StudentHunter.SecurityModule' | |
beforeEach module 'ui.router' | |
describe '$templateCache decorator', -> | |
beforeEach module ($provide) -> | |
$provide.decorator '$compile', ($delegate) -> | |
return jasmine.createSpy $delegate | |
@template = '<div></div>' | |
it 'puts templates into cache', inject ($templateCache) -> | |
$templateCache.put('cacheKey', @template) | |
expect($templateCache.get('cacheKey')).toEqual @template | |
it 'calls assets partials and compile response if cache key not found', inject ($injector, $templateCache, SecurityConstants) -> | |
$httpBackend = $injector.get '$httpBackend' | |
$compile = $injector.get '$compile' | |
$httpBackend.whenGET("#{SecurityConstants.assetsHost}/templates/partials.html").respond @template | |
$templateCache.get 'notExistingCacheKey' | |
$httpBackend.flush() | |
expect($compile).toHaveBeenCalledWith @template |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment