Skip to content

Commit

Permalink
Fixed unit tests for macOS and Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
colemancda committed Jun 6, 2017
1 parent 99b6111 commit 7a8ded9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions Tests/SilicaTests/Utilities/HTTP/HTTPClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,20 @@ public extension HTTP {
/// Loads HTTP requests
public final class Client {

public init(session: URLSession = URLSession.shared) {
public init(session: URLSession? = nil) {

self.session = session
if let session = session {

self.session = session

} else {

#if os(macOS)
self.session = URLSession.shared
#else
self.session = URLSession(configuration: URLSessionConfiguration())
#endif
}
}

/// The backing ```NSURLSession```.
Expand Down
2 changes: 1 addition & 1 deletion Tests/SilicaTests/Utilities/TestAssets.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ final class TestAssetManager {

let cacheDirectory: URL

let httpClient = HTTP.Client(session: URLSession(configuration: URLSessionConfiguration()))
let httpClient = HTTP.Client()

private(set) var downloadedAssets = [TestAsset]()

Expand Down

0 comments on commit 7a8ded9

Please sign in to comment.