2019-01-05 17:37:34 +00:00
|
|
|
//
|
2019-01-06 21:01:08 +00:00
|
|
|
// URLSessionDataTaskMock .swift
|
2019-01-05 17:37:34 +00:00
|
|
|
// MasKitTests
|
|
|
|
//
|
|
|
|
// Created by Ben Chatelain on 1/5/19.
|
|
|
|
// Copyright © 2019 mas-cli. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
|
|
|
// Partial mock subclassing the original class
|
2019-01-06 21:01:08 +00:00
|
|
|
class URLSessionDataTaskMock: URLSessionDataTask {
|
2019-01-05 17:37:34 +00:00
|
|
|
private let closure: () -> Void
|
|
|
|
|
|
|
|
init(closure: @escaping () -> Void) {
|
|
|
|
self.closure = closure
|
|
|
|
}
|
2019-01-12 00:33:41 +00:00
|
|
|
|
2019-01-05 17:37:34 +00:00
|
|
|
// We override the 'resume' method and simply call our closure
|
|
|
|
// instead of actually resuming any task.
|
|
|
|
override func resume() {
|
|
|
|
closure()
|
|
|
|
}
|
|
|
|
}
|