|
189 | 189 | });
|
190 | 190 | });
|
191 | 191 |
|
| 192 | +describe(@"-updateTrackingBranch:error:", ^{ |
| 193 | + __block GTBranch *masterBranch; |
| 194 | + beforeEach(^{ |
| 195 | + masterBranch = [repository lookUpBranchWithName:@"master" type:GTBranchTypeLocal success:NULL error:NULL]; |
| 196 | + expect(masterBranch).notTo(beNil()); |
| 197 | + }); |
| 198 | + |
| 199 | + it(@"should set a tracking branch", ^{ |
| 200 | + GTBranch *branch = [repository lookUpBranchWithName:@"feature" type:GTBranchTypeLocal success:NULL error:NULL]; |
| 201 | + expect(branch).notTo(beNil()); |
| 202 | + |
| 203 | + BOOL success = NO; |
| 204 | + GTBranch *trackingBranch = [branch trackingBranchWithError:NULL success:&success]; |
| 205 | + expect(trackingBranch).to(beNil()); |
| 206 | + expect(@(success)).to(beTruthy()); |
| 207 | + |
| 208 | + NSError *error; |
| 209 | + success = [branch updateTrackingBranch:masterBranch error:&error]; |
| 210 | + expect(@(success)).to(beTruthy()); |
| 211 | + expect(error).to(beNil()); |
| 212 | + |
| 213 | + trackingBranch = [branch trackingBranchWithError:NULL success:&success]; |
| 214 | + expect(trackingBranch).notTo(beNil()); |
| 215 | + expect(@(success)).to(beTruthy()); |
| 216 | + }); |
| 217 | + |
| 218 | + it(@"should unset a tracking branch", ^{ |
| 219 | + BOOL success = NO; |
| 220 | + GTBranch *trackingBranch = [masterBranch trackingBranchWithError:NULL success:&success]; |
| 221 | + expect(trackingBranch).notTo(beNil()); |
| 222 | + expect(@(success)).to(beTruthy()); |
| 223 | + |
| 224 | + success = [masterBranch updateTrackingBranch:nil error:NULL]; |
| 225 | + expect(@(success)).to(beTruthy()); |
| 226 | + |
| 227 | + trackingBranch = [masterBranch trackingBranchWithError:NULL success:&success]; |
| 228 | + expect(trackingBranch).to(beNil()); |
| 229 | + expect(@(success)).to(beTruthy()); |
| 230 | + }); |
| 231 | +}); |
| 232 | + |
192 | 233 | // TODO: Test branch renaming, branch upstream
|
193 | 234 | //- (void)testCanRenameBranch {
|
194 | 235 | //
|
|
0 commit comments