|
100 | 100 | error = NULL;
|
101 | 101 | });
|
102 | 102 |
|
| 103 | + context(@"when -pushBranch: is given invalid parameters", ^{ |
| 104 | + it(@"needs a non-nil branch", ^{ |
| 105 | + XCTAssertThrowsSpecificNamed([localRepo pushBranch:nil toRemote:remote withOptions:nil error:&error progress:NULL], NSException, NSInternalInconsistencyException, @"should throw NSInternalInconsistencyException"); |
| 106 | + }); |
| 107 | + |
| 108 | + it(@"needs a non-nil remote", ^{ |
| 109 | + GTBranch *masterBranch = localBranchWithName(@"master", localRepo); |
| 110 | + XCTAssertThrowsSpecificNamed([localRepo pushBranch:masterBranch toRemote:nil withOptions:nil error:&error progress:NULL], NSException, NSInternalInconsistencyException, @"should throw NSInternalInconsistencyException"); |
| 111 | + }); |
| 112 | + }); |
| 113 | + |
| 114 | + context(@"when -pushBranches: is given invalid parameters", ^{ |
| 115 | + it(@"needs a non-nil branch array", ^{ |
| 116 | + XCTAssertThrowsSpecificNamed([localRepo pushBranches:nil toRemote:remote withOptions:nil error:&error progress:NULL], NSException, NSInternalInconsistencyException, @"should throw NSInternalInconsistencyException"); |
| 117 | + }); |
| 118 | + |
| 119 | + it(@"needs a non-empty branch array", ^{ |
| 120 | + XCTAssertThrowsSpecificNamed([localRepo pushBranches:@[] toRemote:remote withOptions:nil error:&error progress:NULL], NSException, NSInternalInconsistencyException, @"should throw NSInternalInconsistencyException"); |
| 121 | + }); |
| 122 | + |
| 123 | + it(@"needs a non-nil remote", ^{ |
| 124 | + GTBranch *masterBranch = localBranchWithName(@"master", localRepo); |
| 125 | + XCTAssertThrowsSpecificNamed([localRepo pushBranches:@[masterBranch] toRemote:nil withOptions:nil error:&error progress:NULL], NSException, NSInternalInconsistencyException, @"should throw NSInternalInconsistencyException"); |
| 126 | + }); |
| 127 | + }); |
| 128 | + |
103 | 129 | context(@"when the local and remote branches are in sync", ^{
|
104 | 130 | it(@"should push no commits", ^{
|
105 | 131 | GTBranch *masterBranch = localBranchWithName(@"master", localRepo);
|
|
142 | 168 | expect(@([localTrackingBranch numberOfCommitsWithError:NULL])).to(equal(@3));
|
143 | 169 |
|
144 | 170 | // Number of commits on remote before push
|
145 |
| -// GTBranch *remoteMasterBranch = localBranchWithName(@"master", remoteRepo); |
146 |
| -// expect(@([remoteMasterBranch numberOfCommitsWithError:NULL])).to(equal(@3)); |
| 171 | + GTBranch *remoteMasterBranch = localBranchWithName(@"master", remoteRepo); |
| 172 | + expect(@([remoteMasterBranch numberOfCommitsWithError:NULL])).to(equal(@3)); |
147 | 173 |
|
148 | 174 | // Push
|
149 | 175 | __block BOOL transferProgressed = NO;
|
|
158 | 184 | localTrackingBranch = [masterBranch trackingBranchWithError:&error success:&success];
|
159 | 185 | expect(error).to(beNil());
|
160 | 186 | expect(@(success)).to(beTrue());
|
161 |
| - expect(@([localTrackingBranch numberOfCommitsWithError:NULL])).to(equal(@3)); |
| 187 | +// expect(@([localTrackingBranch numberOfCommitsWithError:NULL])).to(equal(@3)); |
162 | 188 |
|
163 | 189 | // Refetch master branch to ensure the commit count is accurate
|
164 |
| -// remoteMasterBranch = localBranchWithName(@"master", remoteRepo); |
| 190 | + remoteMasterBranch = localBranchWithName(@"master", remoteRepo); |
165 | 191 |
|
166 | 192 | // Number of commits on remote after push
|
167 |
| -// expect(@([remoteMasterBranch numberOfCommitsWithError:NULL])).to(equal(@4)); |
| 193 | + expect(@([remoteMasterBranch numberOfCommitsWithError:NULL])).to(equal(@4)); |
168 | 194 |
|
169 | 195 | // Verify commit is in remote
|
170 | 196 | GTCommit *pushedCommit = [remoteRepo lookUpObjectByOID:testCommit.OID objectType:GTObjectTypeCommit error:&error];
|
|
0 commit comments