Skip to content

Instantly share code, notes, and snippets.

@jmarnold
Created November 2, 2011 05:54
Show Gist options
  • Save jmarnold/1332990 to your computer and use it in GitHub Desktop.
Save jmarnold/1332990 to your computer and use it in GitHub Desktop.
Sample Jasmine Specs
describe('NavigatePolicyTester', function () {
var policy;
beforeEach(function () {
policy = new Logistics.Ajax.NavigatePolicy();
});
it('should_match_when_continuation_specifies_navigate', function () {
expect(policy.matches({ navigatePage: 'www.google.com' })).toEqual(true);
});
it('should_not_match_when_continuation_does_not_specify_navigate', function () {
expect(policy.matches({})).toEqual(false);
});
it('should_navigate_to_page', function () {
Logistics.WindowService.navigateTo = jasmine.createSpy('WindowService.navigateTo');
var url = 'http://www.google.com';
policy.execute({
navigatePage: url
});
expect(Logistics.WindowService.navigateTo).toHaveBeenCalledWith(url);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment