mas/MasKitTests/Network/URLSessionDataTaskMock.swift

25 lines
555 B
Swift
Raw Normal View History

//
// 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
}
2019-01-12 00:33:41 +00:00
// We override the 'resume' method and simply call our closure
// instead of actually resuming any task.
override func resume() {
closure()
}
}