|
109 | 109 |
|
110 | 110 | __block GTRepository *bareRepository; |
111 | 111 | __block NSError *error; |
112 | | -__block void (^isValidReference)(GTReference *ref, NSString *SHA, GTReferenceType type, NSString *name); |
| 112 | + |
| 113 | +void (^expectValidReference)(GTReference *ref, NSString *SHA, GTReferenceType type, NSString *name) = ^(GTReference *ref, NSString *SHA, GTReferenceType type, NSString *name) { |
| 114 | + expect(ref).notTo.beNil(); |
| 115 | + expect(ref.targetSHA).to.equal(SHA); |
| 116 | + expect(ref.referenceType).to.equal(type); |
| 117 | + expect(ref.name).to.equal(name); |
| 118 | +}; |
113 | 119 |
|
114 | 120 | beforeEach(^{ |
115 | 121 | bareRepository = self.bareFixtureRepository; |
116 | 122 | error = nil; |
117 | | - isValidReference = ^(GTReference *ref, NSString *SHA, GTReferenceType type, NSString *name) { |
118 | | - expect(ref).notTo.beNil(); |
119 | | - expect(ref.targetSHA).to.equal(SHA); |
120 | | - expect(ref.referenceType).to.equal(type); |
121 | | - expect(ref.name).to.equal(name); |
122 | | - }; |
123 | 123 | }); |
124 | 124 |
|
125 | 125 | describe(@"+referenceByLookingUpReferenceNamed:inRepository:error:", ^{ |
|
128 | 128 | expect(ref).notTo.beNil(); |
129 | 129 | expect(error).to.beNil(); |
130 | 130 |
|
131 | | - isValidReference(ref, @"36060c58702ed4c2a40832c51758d5344201d89a", GTReferenceTypeOid, @"refs/heads/master"); |
| 131 | + expectValidReference(ref, @"36060c58702ed4c2a40832c51758d5344201d89a", GTReferenceTypeOid, @"refs/heads/master"); |
132 | 132 | }); |
133 | 133 |
|
134 | 134 | it(@"should return a valid reference to a tag", ^{ |
135 | 135 | GTReference *ref = [GTReference referenceByLookingUpReferencedNamed:@"refs/tags/v0.9" inRepository:bareRepository error:&error]; |
136 | 136 | expect(ref).notTo.beNil(); |
137 | 137 | expect(error).to.beNil(); |
138 | 138 |
|
139 | | - isValidReference(ref, @"5b5b025afb0b4c913b4c338a42934a3863bf3644", GTReferenceTypeOid, @"refs/tags/v0.9"); |
| 139 | + expectValidReference(ref, @"5b5b025afb0b4c913b4c338a42934a3863bf3644", GTReferenceTypeOid, @"refs/tags/v0.9"); |
140 | 140 | }); |
141 | 141 | }); |
142 | 142 |
|
|
146 | 146 | expect(error).to.beNil(); |
147 | 147 | expect(ref).notTo.beNil(); |
148 | 148 |
|
149 | | - isValidReference(ref, @"36060c58702ed4c2a40832c51758d5344201d89a", GTReferenceTypeSymbolic, @"refs/heads/unit_test"); |
| 149 | + expectValidReference(ref, @"36060c58702ed4c2a40832c51758d5344201d89a", GTReferenceTypeSymbolic, @"refs/heads/unit_test"); |
150 | 150 | expect(ref.resolvedReference.name).to.equal(@"refs/heads/master"); |
151 | 151 | }); |
152 | 152 |
|
|
155 | 155 | expect(error).to.beNil(); |
156 | 156 | expect(ref).notTo.beNil(); |
157 | 157 |
|
158 | | - isValidReference(ref, @"36060c58702ed4c2a40832c51758d5344201d89a", GTReferenceTypeOid, @"refs/heads/unit_test"); |
| 158 | + expectValidReference(ref, @"36060c58702ed4c2a40832c51758d5344201d89a", GTReferenceTypeOid, @"refs/heads/unit_test"); |
159 | 159 | }); |
160 | 160 | }); |
161 | 161 |
|
|
0 commit comments