AliSoftware / OHHTTPStubs

Stub your network requests easily! Test your apps with fake network data and custom response time, response code and headers!
MIT License
5.03k stars 601 forks source link

OHHTTPStubs not working with watchOS #287

Open tfonfara opened 6 years ago

tfonfara commented 6 years ago

New Issue Checklist

Environment

Issue Description

Stubs are never considered for watchOS, same code runs fine in iOS.

Steps to reproduce

  1. Create an iOS + watchOS application
  2. Add the following code in both apps, this should return empty data for all requests:
    stub(condition: isScheme("http") || isScheme("https")) { _ in
    return OHHTTPStubsResponse(data: Data(), statusCode: 200, headers: nil)
    }
  3. Add code to download any file and print contents

Expectation: Output should be empty in both apps (as the stubs are returning an empty data object) Results iOS: Empty output is printed Results watchOS: Actual file contents are printed, download was not stubbed

Can also be veryfied using breakpoints, for watchOS the return statement is never being called.

AliSoftware commented 6 years ago

There's actually a very recent PR to precisely add support for watchOS 😉

https://github.com/AliSoftware/OHHTTPStubs/pull/286

tfonfara commented 6 years ago

Oh didn't see that, I only checked issues 🙈 I thought as it's listed in podfile it is already supporting watchos^^