mas/MasKitTests/Network/URLSessionDataTaskMock.swift
2019-01-11 17:33:41 -07:00

24 lines
555 B
Swift

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