Skip to content

Commit 6085301

Browse files
committed
Test it.
1 parent 5269363 commit 6085301

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

ObjectiveGitTests/GTBranchSpec.m

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,44 @@
190190
});
191191

192192
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());
193212

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+
});
194231
});
195232

196233
// TODO: Test branch renaming, branch upstream

0 commit comments

Comments
 (0)