-
Notifications
You must be signed in to change notification settings - Fork 602
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't get OHHTTPStubs to work with NSURLSession (Bug?) #38
Comments
Maybe related to #37? Are you using CocoaPods to integrate What is your Thx |
If you are using cocoapods there is an issue if you have the pod in both targets, so you should probably do: target :TargetTests, :exclusive => true do
pod 'OHHTTPStubs'
end |
@AliSoftware Thanks for the quick reply, @alvarezloaiciga I'm not using CocoaPods... I'm trying to integrate the library manually. I think the easiest thing is to provide you a link to the project. You can go to You can set a breakpoint in Hope this helps you out :) |
@alvarezloaiciga Are you talking about an issue in CocoaPods, or an issue in @Goles Thx I'll take a look! |
@Goles I don't understand your example project/workspace configuration:
The |
Great! Let me know if I can help! Sent from my iPhone
|
Also you call The method As stated in Apple's Note that there is also a reminder in my own documentation (see the In practice, due to my method swizzling that should be magically done by my |
Another note: your Still not related to the original issue, but I thought you should know and fix your code on this too. |
@alvarezloaiciga @Goles Please test the new HEAD (latest commit that includes my fix) to validate it correctly fixes your issues |
Wow you guys are fast, will validate it asap. |
@AliSoftware It's fixed, working fine now. 👍 |
Great 😃 Note that from now on you won't need to call ➡️ So you can completely remove your call to The only usage you could have for |
@AliSoftware Yeah, I just added the On a side-note, I was going to add the time-out thing too: - (void)spinRunLoopWithTimeout:(NSTimeInterval)timeout predicate:(BOOL (^)())predicate
{
NSDate *future = [NSDate dateWithTimeIntervalSinceNow:timeout];
while (predicate() == NO && [[NSDate date] earlierDate:future] != future) {
if ([future timeIntervalSinceNow] <= 0.0f) {
XCTFail(@"Timeout...");
}
CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, YES);
}
} I think this is better. Thanks again for your help! |
Ok thx. Regarding your I suggest you remove your
|
Lol, you're correct, pasted the wrong snippet ;) |
|
I'm trying to use OHHTTPStubs in my XCTest class,
This is how I configured
OHTTPStubs
in my test file.And this is how I'm performing a request
In the
completionHandler
callback I'm basically getting a no domain found error (error NSURLError * domain: @"NSURLErrorDomain" - code: -1003 0x08a70740
) ,@"A server with the specified hostname could not be found."
I'm completely sure that I'm querying the correct URL (the one I stubbed with
OHHTTPStubs
) in my test.What could be going on here? Bug maybe?
The text was updated successfully, but these errors were encountered: