Skip to content

Commit 3fa1306

Browse files
committed
Merge pull request hyperoslo#28 from hyperoslo/fix/tests
Fix Expire date issues that screwed up tests on older devices.
2 parents a851ce8 + 81ccfa7 commit 3fa1306

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Source/Shared/DataStructures/Expiry.swift

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ public enum Expiry {
1010

1111
switch self {
1212
case .Never:
13-
result = NSDate.distantFuture()
13+
// Ref: http://lists.apple.com/archives/cocoa-dev/2005/Apr/msg01833.html
14+
result = NSDate(timeIntervalSince1970: 60 * 60 * 24 * 365 * 68)
1415
case .Seconds(let seconds):
1516
result = NSDate().dateByAddingTimeInterval(seconds)
1617
case .Date(let date):
@@ -19,4 +20,4 @@ public enum Expiry {
1920

2021
return result
2122
}
22-
}
23+
}

Tests/iOS/Specs/DataStructures/ExpirySpec.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class ExpirySpec: QuickSpec {
1010

1111
describe("#date") {
1212
it("returns date in the distant future") {
13-
let date = NSDate.distantFuture()
13+
let date = NSDate(timeIntervalSince1970: 60 * 60 * 24 * 365 * 68)
1414
expiry = .Never
1515

1616
expect(expiry.date).to(equal(date))

0 commit comments

Comments
 (0)