Last active
August 29, 2015 13:56
-
-
Save rolaveric/8814223 to your computer and use it in GitHub Desktop.
Shows how to get a reference to a provider, before "provider.$get()" is called, for testing.
This file contains 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('myServiceProvider', function () { | |
var p; | |
// Uses the "module()" method to get a reference to the provider during the "config" phase | |
beforeEach(module('myModule', function (myServiceProvider) { | |
p = myServiceProvider; | |
})); | |
// Runs "inject()" so that the module gets instantiated. | |
// Because "myService" isn't injected, the "myServiceProvider" should still be pristine | |
beforeEach(inject(function () {})); | |
// ... | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment