Latest 0.1.1
Homepage https://github.com/netsells/NSNetworkingMocker
License MIT
Platforms ios 10.0
Authors

Build Status
Version
License
Platform

Purpose

  • To provide an easy way to mock network request with how we use our APIs
  • To provide an easy way to mock APIs while early in development

Docs

Docs created using Jazzy

Set up

Installation

NSNetworkingMocker is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'NSNetworkingMocker'

MockURLProtocol is registered with URLProtocol as soon as a mock is added to the NetworkingMocker.mocks dictionary. After this has taken place it will be used automaticlly when using URLSession.shared.

To proxy a request when using a custom URLSession configuration you will need to do the following:

let config = URLSessionConfiguration.default
config.protocolClasses = [MockURLProtocol.self]
let session = URLSession(configuration: config)

let dataTask = session.dataTask(...

If you use Alamofire then you will need to do the following:

let configuration = URLSessionConfiguration.default
configuration.protocolClasses = [MockingURLProtocol.self]
let sessionManager = SessionManager(configuration: configuration)

Author

ABTucanae, [email protected]

License

NSNetworkingMocker is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "NSNetworkingMocker",
    "version": "0.1.1",
    "summary": "A mocker for help writing tests for network code, or to create a mock api",
    "description": "NSNetworkingMocker is a simple library to provide an easy way to mock network requests for unit tests, and provide an easy way to mock APIs while early in development.",
    "homepage": "https://github.com/netsells/NSNetworkingMocker",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "ABTucanae": "[email protected]"
    },
    "source": {
        "git": "https://github.com/netsells/NSNetworkingMocker.git",
        "tag": "0.1.1"
    },
    "platforms": {
        "ios": "10.0"
    },
    "swift_version": "4.2",
    "source_files": "Sources/*/**/*"
}

Pin It on Pinterest

Share This