Skip to content

Instantly share code, notes, and snippets.

@rolaveric
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rolaveric/8814223 to your computer and use it in GitHub Desktop.
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.
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