Skip to content

Instantly share code, notes, and snippets.

@ThomasBurleson
Created October 15, 2013 01:27
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 ThomasBurleson/6985173 to your computer and use it in GitHub Desktop.
Save ThomasBurleson/6985173 to your computer and use it in GitHub Desktop.
Sample Spec as part of comments "AngularJS - Using Decorators for UnitTesting"
describe("worldGreeter Tests", function()
{
beforeEach( function()
{
module( 'test.myApp' );
/**
* Configure disposable module with values and factories
*/
module( function( $provide )
{
var Greeter = function()
{
return 'Bye';
},
WorldGreeter = ["greeter", function( greeter )
{
return greeter + " World";
}];
$provide.factory( 'greeter', Greeter );
$provide.factory( 'worldGreeter', WorldGreeter );
});
});
it( 'should work with mocked WorldGreeter', function ( worldGreeter )
{
expect( worldGreeter ).toBe( 'Bye World' );
});
});
@ThomasBurleson
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment