AliSoftware / AliSoftware/OHHTTPStubs

OHHTTPStubs not working with Siesta

Đang mở
#285 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
Waiting for input
Ngôn ngữ chính
Objective-C
Star
5.1k
Fork
597
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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:

```
func testGetData(){
stub(condition: isPath("https://www.test.com/data/data.json")) { request in
let stubPath = OHPathForFile("testData.json", type(of: self)) // break point
return fixture(filePath: stubPath!, headers: ["Content-Type":"application/json"])
}
let expectation = self.expectation(description: "calls the callback with a resource object")
manager.getData(onSuccess: { (data) in
XCTAssertGreaterThan(data.count, 0, "Failed to get data")
expectation.fulfill()
}) { (error) in
XCTFail()
}
self.waitForExpectations(timeout: 0.5, handler: .none)
}
```
I put a breakpoint inside the closure of the stub but it doesn't enter it. I also tried `isHost("test.com")` and is `isMethodGET()` but still nothing :(

PS : the path for the json file is : test.com/data/data.json

Environment

- OHHTTPStubs 6.1.0
- Siesta 1.4.0
- Cocoapods 1.5.0
- XCode 9.4
- Swift 4

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.