Last active
August 29, 2015 14:09
-
-
Save KamilLelonek/e4f504c29c8763ddb4f7 to your computer and use it in GitHub Desktop.
Test suite for AssetsPartialsLoader extension
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.SecurityModule' | |
beforeEach module 'StudentHunter.ExtensionsModule' | |
describe "AssetsPartialsLoader load", -> | |
beforeEach module ($provide) -> | |
$provide.decorator '$compile', ($delegate) -> | |
return jasmine.createSpy $delegate | |
beforeEach inject (@$compile, @AssetsPartialsLoader, $injector, @SecurityConstants) -> | |
@$httpBackend = $injector.get '$httpBackend' | |
@assetsPartialsHost = "#{@SecurityConstants.assetsHost}/templates/partials.html" | |
@fakeTemplate = '<div></div>' | |
it 'should call assets partials API when assetsPartialsLoaded flag is falsy', -> | |
@$httpBackend.expectGET(@assetsPartialsHost).respond @fakeTemplate | |
@AssetsPartialsLoader.load() | |
@$httpBackend.flush() | |
it 'should compile loaded templates', -> | |
@$httpBackend.whenGET(@assetsPartialsHost).respond @fakeTemplate | |
@AssetsPartialsLoader.load() | |
@$httpBackend.flush() | |
expect(@$compile).toHaveBeenCalledWith @fakeTemplate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment