Skip to content

Commit

Permalink
Short spec to document why we close over Date and ensure cross-browse…
Browse files Browse the repository at this point in the history
…r compatibility

[closes jasmine#506]
  • Loading branch information
sheelc committed Feb 9, 2014
1 parent b5775ae commit 289c831
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions spec/core/TimerSpec.js
Expand Up @@ -10,4 +10,22 @@ describe("Timer", function() {

expect(timer.elapsed()).toEqual(100);
});

describe("when date is stubbed, perhaps by other testing helpers", function() {
var origDate = Date;
beforeEach(function() {
Date = jasmine.createSpy('date spy');
});

afterEach(function() {
Date = origDate;
});

it("does not throw even though Date was taken away", function() {
var timer = new j$.Timer();

expect(timer.start).not.toThrow();
expect(timer.elapsed()).toEqual(jasmine.any(Number));
});
});
});

0 comments on commit 289c831

Please sign in to comment.