Skip to content

Commit

Permalink
Fixes tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
csabol-stripe committed Jun 18, 2018
1 parent 2c02f54 commit d61bb1e
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Tests/Tests/STPAPIRequestTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ - (void)testPostWithAPIClient {
STPAPIClient *apiClientMock = OCMClassMock([STPAPIClient class]);
OCMStub([apiClientMock apiURL]).andReturn([NSURL URLWithString:@"https://api.stripe.com"]);
OCMStub([apiClientMock urlSession]).andReturn(urlSessionMock);
OCMStub([apiClientMock configuredRequestForURL:[OCMArg isKindOfClass:[NSURL class]]]).andDo(^(NSInvocation *invocation)
{
NSURL *urlArg;
[invocation getArgument:&urlArg atIndex:2];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:urlArg];
[invocation setReturnValue:&request];
[invocation retainArguments];
});

id apiRequestMock = OCMClassMock([STPAPIRequest class]);
OCMStub([apiRequestMock parseResponse:[OCMArg any]
Expand Down Expand Up @@ -117,6 +125,14 @@ - (void)testGetWithAPIClient {
STPAPIClient *apiClientMock = OCMClassMock([STPAPIClient class]);
OCMStub([apiClientMock apiURL]).andReturn([NSURL URLWithString:@"https://api.stripe.com"]);
OCMStub([apiClientMock urlSession]).andReturn(urlSessionMock);
OCMStub([apiClientMock configuredRequestForURL:[OCMArg isKindOfClass:[NSURL class]]]).andDo(^(NSInvocation *invocation)
{
NSURL *urlArg;
[invocation getArgument:&urlArg atIndex:2];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:urlArg];
[invocation setReturnValue:&request];
[invocation retainArguments];
});

id apiRequestMock = OCMClassMock([STPAPIRequest class]);
OCMStub([apiRequestMock parseResponse:[OCMArg any]
Expand Down Expand Up @@ -185,6 +201,14 @@ - (void)testDeleteWithAPIClient {
STPAPIClient *apiClientMock = OCMClassMock([STPAPIClient class]);
OCMStub([apiClientMock apiURL]).andReturn([NSURL URLWithString:@"https://api.stripe.com"]);
OCMStub([apiClientMock urlSession]).andReturn(urlSessionMock);
OCMStub([apiClientMock configuredRequestForURL:[OCMArg isKindOfClass:[NSURL class]]]).andDo(^(NSInvocation *invocation)
{
NSURL *urlArg;
[invocation getArgument:&urlArg atIndex:2];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:urlArg];
[invocation setReturnValue:&request];
[invocation retainArguments];
});

id apiRequestMock = OCMClassMock([STPAPIRequest class]);
OCMStub([apiRequestMock parseResponse:[OCMArg any]
Expand Down

0 comments on commit d61bb1e

Please sign in to comment.