Skip to content

Commit

Permalink
Merge pull request #28 from hyperoslo/fix/tests
Browse files Browse the repository at this point in the history
Fix Expire date issues that screwed up tests on older devices.
  • Loading branch information
vadymmarkov committed Mar 29, 2016
2 parents a851ce8 + 81ccfa7 commit 3fa1306
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Source/Shared/DataStructures/Expiry.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ public enum Expiry {

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

return result
}
}
}
2 changes: 1 addition & 1 deletion Tests/iOS/Specs/DataStructures/ExpirySpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class ExpirySpec: QuickSpec {

describe("#date") {
it("returns date in the distant future") {
let date = NSDate.distantFuture()
let date = NSDate(timeIntervalSince1970: 60 * 60 * 24 * 365 * 68)
expiry = .Never

expect(expiry.date).to(equal(date))
Expand Down

0 comments on commit 3fa1306

Please sign in to comment.