Skip to content

Commit 74f421c

Browse files
wangjoshuahalda-optimizely
authored andcommitted
remove stubs after test finishes
1 parent b968bce commit 74f421c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

OptimizelySDKShared/OptimizelySDKSharedTests/OPTLYManagerTest.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ - (void)testInitializeClientAsync {
122122
XCTAssertEqual(manager.datafile, kDefaultDatafile);
123123

124124
// stub network call
125-
[OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest *request) {
125+
id<OHHTTPStubsDescriptor> stub = [OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest *request) {
126126
return [request.URL.host isEqualToString:@"cdn.optimizely.com"];
127127
} withStubResponse:^OHHTTPStubsResponse*(NSURLRequest *request) {
128128
// Stub it with our "wsresponse.json" stub file (which is in same bundle as self)
@@ -150,6 +150,9 @@ - (void)testInitializeClientAsync {
150150
// wait for async start to finish
151151
[self waitForExpectationsWithTimeout:2 handler:nil];
152152
XCTAssertEqual(optimizelyClient, manager.getOptimizely);
153+
154+
// clean up stub
155+
[OHHTTPStubs removeStub:stub];
153156
}
154157

155158
- (void)checkConfigIsUsingDefaultDatafile: (OPTLYProjectConfig *)config {

0 commit comments

Comments
 (0)