Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update the unit tests to use the new API.

  • Loading branch information...
commit 92d18936f6de87c2b94392f999c4a92e65a4f5ca 1 parent 03baa76
Danny Greg authored
Showing with 4 additions and 4 deletions.
  1. +4 −4 ObjectiveGitTests/GTTimeAdditionsSpec.m
View
8 ObjectiveGitTests/GTTimeAdditionsSpec.m
@@ -11,14 +11,12 @@
SpecBegin(GTTimeAdditions)
describe(@"Conversion between git_time and NSDate", ^{
- it(@"should be able to create an NSDate when given a git_time", ^{
+ it(@"should be able to create a correct NSDate and NSTimeZone when given a git_time", ^{
git_time_t seconds = 1265374800;
int offset = -120; //2 hours behind GMT
git_time time = (git_time){ .time = seconds, .offset = offset };
- NSTimeZone *timeZone = nil;
- NSDate *date = [NSDate gt_dateFromGitTime:time timeZone:&timeZone];
+ NSDate *date = [NSDate gt_dateFromGitTime:time];
expect(date).toNot.beNil();
- expect(timeZone).toNot.beNil();
NSCalendar *gregorianCalendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *components = [gregorianCalendar components:NSDayCalendarUnit | NSMonthCalendarUnit | NSYearCalendarUnit | NSHourCalendarUnit fromDate:date];
@@ -29,6 +27,8 @@
expect(components.year).to.equal(2010);
expect(components.hour).to.equal(13);
+ NSTimeZone *timeZone = [NSTimeZone gt_timeZoneFromGitTime:time];
+ expect(timeZone).toNot.beNil();
NSInteger expectedSecondsFromGMT = -120 * 60;
expect(timeZone.secondsFromGMT).to.equal(expectedSecondsFromGMT);
});
Please sign in to comment.
Something went wrong with that request. Please try again.