Open kamaki94 opened 6 years ago
Hi @kamaki94
Sorry for the late reply but did you try using a closure in condition
to see if a request is at least captured by OHHTTPStubs
?
I cannot help you more as you do not provide the implementation of your manager.getData
call and I did not try OHHTTPStubs
with Siesta
myself.
If you are still experiencing the issue, it would be great if you could give us a sample project reproducing it 👌
I've hit the same issue even on 8.0
and the solution is to avoid using the helper method isPath
.
Instead pass a closure and compare the URLs:
let targetURL = self.apiClient.signin.url.absoluteString
stub(condition: { (request) -> Bool in
if let absoluteURL = request.url?.absoluteString {
return absoluteURL == targetURL
}
return false
}) { _ in
return OHHTTPStubsResponse(data: stubData , statusCode: 200, headers: ["Content-Type": "application/json"])
}
I have a data manger that gets a json file from the server an I want to test that call using my own json file . I am using Siesta for API and OHHTTPStubs for stubbing , but for some reason, the stubbing doesn't work.Here the step I did to use it :
I added OHHTTPStubs to pod file
pod 'OHHTTPStubs/Swift'
In test method I wrote this:
I put a breakpoint inside the closure of the stub but it doesn't enter it. I also tried
isHost("test.com")
and isisMethodGET()
but still nothing :(PS : the path for the json file is : test.com/data/data.json
Environment