-
Notifications
You must be signed in to change notification settings - Fork 285
Expand file tree
/
Copy pathGTSignatureSpec.m
More file actions
65 lines (49 loc) · 1.75 KB
/
GTSignatureSpec.m
File metadata and controls
65 lines (49 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//
// GTSignatureSpec.m
// ObjectiveGitFramework
//
// Created by Justin Spahr-Summers on 2013-06-26.
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
//
@import ObjectiveGit;
@import Nimble;
@import Quick;
#import "QuickSpec+GTFixtures.h"
QuickSpecBegin(GTSignatureSpec)
NSString *name = @"test_user";
NSString *email = @"[email protected]";
__block NSDate *time;
beforeEach(^{
time = [NSDate date];
});
describe(@"instance", ^{
__block GTSignature *testSignature;
beforeEach(^{
testSignature = [[GTSignature alloc] initWithName:name email:email time:time];
expect(testSignature).notTo(beNil());
});
it(@"should expose the git_signature", ^{
expect([NSValue valueWithPointer:testSignature.git_signature]).notTo(equal([NSValue valueWithPointer:NULL]));
expect(testSignature).to(equal([[GTSignature alloc] initWithGitSignature:testSignature.git_signature]));
});
it(@"should compare equal to a signature created with the same information", ^{
expect(testSignature).to(equal([[GTSignature alloc] initWithName:name email:email time:time]));
});
it(@"should compare unequal to a different signature", ^{
expect(testSignature).notTo(equal([[GTSignature alloc] initWithName:name email:email time:[NSDate dateWithTimeIntervalSinceNow:10]]));
});
});
it(@"should keep the git_signature alive even if the object goes out of scope", ^{
const git_signature *git_signature = NULL;
{
GTSignature *testSignature = [[GTSignature alloc] initWithName:name email:email time:time];
git_signature = testSignature.git_signature;
}
GTSignature *testSignature = [[GTSignature alloc] initWithGitSignature:git_signature];
expect(testSignature.name).to(equal(name));
expect(testSignature.email).to(equal(email));
});
afterEach(^{
[self tearDown];
});
QuickSpecEnd