Skip to content

Commit 173e177

Browse files
committed
Rename isValidReference and define it at declaration time.
1 parent 86d4f7b commit 173e177

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

ObjectiveGitTests/GTReferenceSpec.m

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,17 @@
109109

110110
__block GTRepository *bareRepository;
111111
__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+
};
113119

114120
beforeEach(^{
115121
bareRepository = self.bareFixtureRepository;
116122
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-
};
123123
});
124124

125125
describe(@"+referenceByLookingUpReferenceNamed:inRepository:error:", ^{
@@ -128,15 +128,15 @@
128128
expect(ref).notTo.beNil();
129129
expect(error).to.beNil();
130130

131-
isValidReference(ref, @"36060c58702ed4c2a40832c51758d5344201d89a", GTReferenceTypeOid, @"refs/heads/master");
131+
expectValidReference(ref, @"36060c58702ed4c2a40832c51758d5344201d89a", GTReferenceTypeOid, @"refs/heads/master");
132132
});
133133

134134
it(@"should return a valid reference to a tag", ^{
135135
GTReference *ref = [GTReference referenceByLookingUpReferencedNamed:@"refs/tags/v0.9" inRepository:bareRepository error:&error];
136136
expect(ref).notTo.beNil();
137137
expect(error).to.beNil();
138138

139-
isValidReference(ref, @"5b5b025afb0b4c913b4c338a42934a3863bf3644", GTReferenceTypeOid, @"refs/tags/v0.9");
139+
expectValidReference(ref, @"5b5b025afb0b4c913b4c338a42934a3863bf3644", GTReferenceTypeOid, @"refs/tags/v0.9");
140140
});
141141
});
142142

@@ -146,7 +146,7 @@
146146
expect(error).to.beNil();
147147
expect(ref).notTo.beNil();
148148

149-
isValidReference(ref, @"36060c58702ed4c2a40832c51758d5344201d89a", GTReferenceTypeSymbolic, @"refs/heads/unit_test");
149+
expectValidReference(ref, @"36060c58702ed4c2a40832c51758d5344201d89a", GTReferenceTypeSymbolic, @"refs/heads/unit_test");
150150
expect(ref.resolvedReference.name).to.equal(@"refs/heads/master");
151151
});
152152

@@ -155,7 +155,7 @@
155155
expect(error).to.beNil();
156156
expect(ref).notTo.beNil();
157157

158-
isValidReference(ref, @"36060c58702ed4c2a40832c51758d5344201d89a", GTReferenceTypeOid, @"refs/heads/unit_test");
158+
expectValidReference(ref, @"36060c58702ed4c2a40832c51758d5344201d89a", GTReferenceTypeOid, @"refs/heads/unit_test");
159159
});
160160
});
161161

0 commit comments

Comments
 (0)