diff --git a/.gitattributes b/.gitattributes index c8fd723..88a2c4b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,7 +1,7 @@ # # .gitattributes # -# Copyright (c) 2016 Netguru Sp. z o.o. All rights reserved. +# Copyright © 2016-2020 Netguru S.A. All rights reserved. # Licensed under the MIT License. # diff --git a/.gitignore b/.gitignore index 7e4f9d1..a489488 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ # # .gitignore # -# Copyright (c) 2016 Netguru Sp. z o.o. All rights reserved. +# Copyright © 2016-2020 Netguru S.A. All rights reserved. # Licensed under the MIT License. # diff --git a/Cartfile.private b/Cartfile.private index f11e7bf..ce9d462 100644 --- a/Cartfile.private +++ b/Cartfile.private @@ -1,7 +1,7 @@ # # Cartfile.private # -# Copyright © 2017 Netguru Sp. z o.o. All rights reserved. +# Copyright © 2017-2020 Netguru S.A. All rights reserved. # Licensed under the MIT License. # diff --git a/LICENSE.md b/LICENSE.md index 05aaaa0..e6711bd 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ MIT License -Copyright © 2017 Netguru Sp. z o.o. +Copyright © 2017-2020 Netguru S.A. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index e03d07c..eeb3bad 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ![](Images/Header.png) ![](https://app.bitrise.io/app/c09426001dedd91c/status.svg?token=4zhZMFtDpH-9BhWvGP5-1g&branch=develop) -![](https://img.shields.io/badge/swift-5.0-orange.svg) +![](https://img.shields.io/badge/swift-5.2-orange.svg) ![](https://img.shields.io/github/release/netguru/ResponseDetective.svg) ![](https://img.shields.io/badge/carthage-compatible-green.svg) ![](https://img.shields.io/badge/cocoapods-compatible-green.svg) @@ -11,7 +11,7 @@ ## Requirements -ResponseDetective is written in **Swift 5.0** and supports **iOS 8.0+**, **macOS 10.10+** and **tvOS 9.0+**. +ResponseDetective is written in **Swift 5.2** and supports **iOS 8.0+**, **macOS 10.10+** and **tvOS 9.0+**. ## Usage @@ -132,7 +132,7 @@ pod 'ResponseDetective', '~> {version}' ## About -This project is made with <3 by [Netguru](https://netguru.co) and maintained by [Adrian Kashivskyy](https://github.com/akashivskyy). +This project was made with ♡ by [Netguru](https://netguru.com) and is now maintained by [Adrian Kashivskyy](https://github.com/akashivskyy). ### Release names @@ -140,4 +140,4 @@ Starting from version 1.0.0, ResponseDetective's releases are named after [Sherl ### License -ResponseDetective is licensed under the MIT License. See [LICENSE.md](LICENSE.md) for more info. +This project is licensed under **MIT License**. See [LICENSE.md](LICENSE.md) for more info. diff --git a/ResponseDetective.playground/Contents.swift b/ResponseDetective.playground/Contents.swift index eeae9ab..90bfe40 100644 --- a/ResponseDetective.playground/Contents.swift +++ b/ResponseDetective.playground/Contents.swift @@ -1,7 +1,7 @@ // // ResponseDetective.playground // -// Copyright © 2016-2017 Netguru Sp. z o.o. All rights reserved. +// Copyright © 2016-2020 Netguru S.A. All rights reserved. // Licensed under the MIT License. // diff --git a/ResponseDetective.podspec b/ResponseDetective.podspec index 38b4911..fa5a0b1 100644 --- a/ResponseDetective.podspec +++ b/ResponseDetective.podspec @@ -1,7 +1,7 @@ # # ResponseDetective.podspec # -# Copyright © 2017 Netguru Sp. z o.o. All rights reserved. +# Copyright © 2017-2020 Netguru S.A. All rights reserved. # Licensed under the MIT License. # @@ -10,7 +10,7 @@ Pod::Spec.new do |spec| # Description spec.name = 'ResponseDetective' - spec.version = '1.3.0' + spec.version = '1.4.0' spec.summary = 'Sherlock Holmes of the networking layer' spec.homepage = 'https://github.com/netguru/ResponseDetective' @@ -46,7 +46,7 @@ Pod::Spec.new do |spec| # Settings - spec.swift_version = '5.0' + spec.swift_version = '5.2' spec.requires_arc = true diff --git a/ResponseDetective.xcodeproj/project.pbxproj b/ResponseDetective.xcodeproj/project.pbxproj index 079dcc3..cde10c6 100644 --- a/ResponseDetective.xcodeproj/project.pbxproj +++ b/ResponseDetective.xcodeproj/project.pbxproj @@ -633,8 +633,8 @@ CLASSPREFIX = RDT; LastSwiftMigration = 0700; LastSwiftUpdateCheck = 0820; - LastUpgradeCheck = 1020; - ORGANIZATIONNAME = "Netguru Sp. z o.o."; + LastUpgradeCheck = 1140; + ORGANIZATIONNAME = "Netguru S.A."; TargetAttributes = { 3A2007D71B5501BC00769021 = { CreatedOnToolsVersion = 6.4; diff --git a/ResponseDetective.xcodeproj/xcshareddata/xcschemes/ResponseDetective-iOS.xcscheme b/ResponseDetective.xcodeproj/xcshareddata/xcschemes/ResponseDetective-iOS.xcscheme index f9e7615..91aa3a0 100644 --- a/ResponseDetective.xcodeproj/xcshareddata/xcschemes/ResponseDetective-iOS.xcscheme +++ b/ResponseDetective.xcodeproj/xcshareddata/xcschemes/ResponseDetective-iOS.xcscheme @@ -1,6 +1,6 @@ + shouldUseLaunchSchemeArgsEnv = "YES" + codeCoverageEnabled = "YES"> + + + + @@ -54,17 +63,6 @@ - - - - - - - - + shouldUseLaunchSchemeArgsEnv = "YES" + codeCoverageEnabled = "YES"> + + + + @@ -54,17 +63,6 @@ - - - - - - - - + shouldUseLaunchSchemeArgsEnv = "YES" + codeCoverageEnabled = "YES"> + + + + @@ -54,17 +63,6 @@ - - - - - - - - [RESPONSE] 200 (NO ERROR) https://httpbin.org/post @@ -91,7 +91,7 @@ import Foundation ("Body", body), ]) } - + /// Prints the error in the following format: /// /// <0xbadf00d> [ERROR] NSURLErrorDomain -1009 @@ -110,7 +110,7 @@ import Foundation } // MARK: Printing boxes - + /// Composes a box string in the following format: /// /// box title @@ -131,7 +131,7 @@ import Foundation } } } - + /// Composes and prints the box sting in the console. /// /// - Parameters: @@ -141,5 +141,5 @@ import Foundation private func printBoxString(title: String, sections: [(String, [String])]) { printClosure(composeBoxString(title: title, sections: sections)) } - + } diff --git a/ResponseDetective/Sources/Dictionary.swift b/ResponseDetective/Sources/Dictionary.swift index 7985145..f5cf2db 100644 --- a/ResponseDetective/Sources/Dictionary.swift +++ b/ResponseDetective/Sources/Dictionary.swift @@ -1,7 +1,7 @@ // // Dictionary.swift // -// Copyright © 2016-2017 Netguru Sp. z o.o. All rights reserved. +// Copyright © 2016-2020 Netguru S.A. All rights reserved. // Licensed under the MIT License. // diff --git a/ResponseDetective/Sources/ErrorRepresentation.swift b/ResponseDetective/Sources/ErrorRepresentation.swift index 90566b9..377cbfb 100644 --- a/ResponseDetective/Sources/ErrorRepresentation.swift +++ b/ResponseDetective/Sources/ErrorRepresentation.swift @@ -1,7 +1,7 @@ // // ErrorRepresentation.swift // -// Copyright © 2016-2017 Netguru Sp. z o.o. All rights reserved. +// Copyright © 2016-2020 Netguru S.A. All rights reserved. // Licensed under the MIT License. // @@ -29,7 +29,7 @@ import Foundation self.reason = reason self.userInfo = userInfo } - + /// Initializes the receiver. /// /// - Parameters: @@ -48,30 +48,30 @@ import Foundation } // MARK: Properties - + /// The request's unique identifier. public let requestIdentifier: String - + /// The response representation that came along with the error. public let response: ResponseRepresentation? - + /// The error domain. public let domain: String - + /// The error code. public let code: Int - + /// The error reason. public let reason: String - + /// The error user info. public let userInfo: [String: Any] // MARK: Unavailable - + /// An unavailable initializer. @available(*, unavailable) public override init() { fatalError("\(#function) is not implemented."); } - + } diff --git a/ResponseDetective/Sources/ImageBodyDeserializer.swift b/ResponseDetective/Sources/ImageBodyDeserializer.swift index 08a9890..d30e72e 100644 --- a/ResponseDetective/Sources/ImageBodyDeserializer.swift +++ b/ResponseDetective/Sources/ImageBodyDeserializer.swift @@ -1,7 +1,7 @@ // // ImageBodyDeserializer.swift // -// Copyright © 2016-2017 Netguru Sp. z o.o. All rights reserved. +// Copyright © 2016-2020 Netguru S.A. All rights reserved. // Licensed under the MIT License. // @@ -23,10 +23,10 @@ #endif // MARK: BodyDeserializer - + /// Deserializes image data into a pretty-printed string. public func deserialize(body: Data) -> String? { return Image(data: body).map { "\(Int($0.size.width))px × \(Int($0.size.height))px image" } } - + } diff --git a/ResponseDetective/Sources/JSONBodyDeserializer.swift b/ResponseDetective/Sources/JSONBodyDeserializer.swift index e7e7dad..f8a2090 100644 --- a/ResponseDetective/Sources/JSONBodyDeserializer.swift +++ b/ResponseDetective/Sources/JSONBodyDeserializer.swift @@ -1,7 +1,7 @@ // // JSONBodyDeserializer.swift // -// Copyright © 2016-2017 Netguru Sp. z o.o. All rights reserved. +// Copyright © 2016-2020 Netguru S.A. All rights reserved. // Licensed under the MIT License. // @@ -11,7 +11,7 @@ import Foundation @objc(RDTJSONBodyDeserializer) public final class JSONBodyDeserializer: NSObject, BodyDeserializer { // MARK: BodyDeserializer - + /// Deserializes JSON data into a pretty-printed string. public func deserialize(body: Data) -> String? { do { @@ -22,5 +22,5 @@ import Foundation return nil } } - + } diff --git a/ResponseDetective/Sources/OutputFacility.swift b/ResponseDetective/Sources/OutputFacility.swift index 9c702ce..15ff48f 100644 --- a/ResponseDetective/Sources/OutputFacility.swift +++ b/ResponseDetective/Sources/OutputFacility.swift @@ -1,7 +1,7 @@ // // OutputFacility.swift // -// Copyright © 2016-2017 Netguru Sp. z o.o. All rights reserved. +// Copyright © 2016-2020 Netguru S.A. All rights reserved. // Licensed under the MIT License. // @@ -10,23 +10,23 @@ import Foundation /// Represents an output facility which is capable of displaying requests, /// responses and errors. @objc(RDTOutputFacility) public protocol OutputFacility { - + /// Outputs a request representation. /// /// - Parameters: /// - request: The request representation to output. @objc(outputRequestRepresentation:) func output(requestRepresentation request: RequestRepresentation) - + /// Outputs a response representation. /// /// - Parameters: /// - response: The response representation to output. @objc(outputResponseRepresentation:) func output(responseRepresentation response: ResponseRepresentation) - + /// Outputs an error representation. /// /// - Parameters: /// - error: The error representation to output. @objc(outputErrorRepresentation:) func output(errorRepresentation error: ErrorRepresentation) - + } diff --git a/ResponseDetective/Sources/PlaintextBodyDeserializer.swift b/ResponseDetective/Sources/PlaintextBodyDeserializer.swift index 28e594c..0658b7d 100644 --- a/ResponseDetective/Sources/PlaintextBodyDeserializer.swift +++ b/ResponseDetective/Sources/PlaintextBodyDeserializer.swift @@ -1,7 +1,7 @@ // // PlaintextBodyDeserializer.swift // -// Copyright © 2016-2017 Netguru Sp. z o.o. All rights reserved. +// Copyright © 2016-2020 Netguru S.A. All rights reserved. // Licensed under the MIT License. // diff --git a/ResponseDetective/Sources/RDTBodyDeserializer.h b/ResponseDetective/Sources/RDTBodyDeserializer.h index 35ec2c6..e0b4cff 100644 --- a/ResponseDetective/Sources/RDTBodyDeserializer.h +++ b/ResponseDetective/Sources/RDTBodyDeserializer.h @@ -1,7 +1,7 @@ // // RDTBodyDeserializer.h // -// Copyright © 2016-2017 Netguru Sp. z o.o. All rights reserved. +// Copyright © 2016-2020 Netguru S.A. All rights reserved. // Licensed under the MIT License. // // This has been implemented as native Objective-C protocol instead of a Swift diff --git a/ResponseDetective/Sources/RDTHTMLBodyDeserializer.h b/ResponseDetective/Sources/RDTHTMLBodyDeserializer.h index 2277cd5..f3deaee 100644 --- a/ResponseDetective/Sources/RDTHTMLBodyDeserializer.h +++ b/ResponseDetective/Sources/RDTHTMLBodyDeserializer.h @@ -1,7 +1,7 @@ // // RDTHTMLBodyDeserializer.h // -// Copyright © 2016-2017 Netguru Sp. z o.o. All rights reserved. +// Copyright © 2016-2020 Netguru S.A. All rights reserved. // Licensed under the MIT License. // diff --git a/ResponseDetective/Sources/RDTHTMLBodyDeserializer.m b/ResponseDetective/Sources/RDTHTMLBodyDeserializer.m index aad4f88..9dbd275 100644 --- a/ResponseDetective/Sources/RDTHTMLBodyDeserializer.m +++ b/ResponseDetective/Sources/RDTHTMLBodyDeserializer.m @@ -1,7 +1,7 @@ // // RDTHTMLBodyDeserializer.m // -// Copyright © 2016-2017 Netguru Sp. z o.o. All rights reserved. +// Copyright © 2016-2020 Netguru S.A. All rights reserved. // Licensed under the MIT License. // diff --git a/ResponseDetective/Sources/RDTXMLBodyDeserializer.h b/ResponseDetective/Sources/RDTXMLBodyDeserializer.h index 82fa22f..b9610e8 100644 --- a/ResponseDetective/Sources/RDTXMLBodyDeserializer.h +++ b/ResponseDetective/Sources/RDTXMLBodyDeserializer.h @@ -1,7 +1,7 @@ // // RDTXMLBodyDeserializer.h // -// Copyright © 2016-2017 Netguru Sp. z o.o. All rights reserved. +// Copyright © 2016-2020 Netguru S.A. All rights reserved. // Licensed under the MIT License. // diff --git a/ResponseDetective/Sources/RDTXMLBodyDeserializer.m b/ResponseDetective/Sources/RDTXMLBodyDeserializer.m index 027ab2d..0722a37 100644 --- a/ResponseDetective/Sources/RDTXMLBodyDeserializer.m +++ b/ResponseDetective/Sources/RDTXMLBodyDeserializer.m @@ -1,7 +1,7 @@ // // RDTXMLBodyDeserializer.m // -// Copyright © 2016-2017 Netguru Sp. z o.o. All rights reserved. +// Copyright © 2016-2020 Netguru S.A. All rights reserved. // Licensed under the MIT License. // diff --git a/ResponseDetective/Sources/RequestRepresentation.swift b/ResponseDetective/Sources/RequestRepresentation.swift index 4c45c80..2b41883 100644 --- a/ResponseDetective/Sources/RequestRepresentation.swift +++ b/ResponseDetective/Sources/RequestRepresentation.swift @@ -1,7 +1,7 @@ // // RequestRepresentation.swift // -// Copyright © 2016-2017 Netguru Sp. z o.o. All rights reserved. +// Copyright © 2016-2020 Netguru S.A. All rights reserved. // Licensed under the MIT License. // @@ -48,27 +48,27 @@ import Foundation } // MARK: Properties - + /// A unique identifier of the request. public let identifier: String - + /// The HTTP method of the request. public let method: String - + /// The resolved URL string of the request. public let urlString: String - + /// The HTTP headers of the request. public let headers: [String: String] - + /// The content type of the request. public var contentType: String { return headers["Content-Type"] ?? "application/octet-stream" } - + /// The raw body data of the request. public let body: Data? - + /// The parsed body of the request. public let deserializedBody: String? diff --git a/ResponseDetective/Sources/ResponseDetective.h b/ResponseDetective/Sources/ResponseDetective.h index 8b6f1d3..03b09d9 100644 --- a/ResponseDetective/Sources/ResponseDetective.h +++ b/ResponseDetective/Sources/ResponseDetective.h @@ -1,7 +1,7 @@ // // ResponseDetective.h // -// Copyright © 2016-2017 Netguru Sp. z o.o. All rights reserved. +// Copyright © 2016-2020 Netguru S.A. All rights reserved. // Licensed under the MIT License. // diff --git a/ResponseDetective/Sources/ResponseDetective.swift b/ResponseDetective/Sources/ResponseDetective.swift index 786f0a6..f9dbec7 100644 --- a/ResponseDetective/Sources/ResponseDetective.swift +++ b/ResponseDetective/Sources/ResponseDetective.swift @@ -1,7 +1,7 @@ // // ResponseDetective.swift // -// Copyright © 2016-2017 Netguru Sp. z o.o. All rights reserved. +// Copyright © 2016-2020 Netguru S.A. All rights reserved. // Licensed under the MIT License. // @@ -12,13 +12,13 @@ import Foundation @objc(RDTResponseDetective) public final class ResponseDetective: NSObject { // MARK: Properties - + /// An output facility for reporting requests, responses and errors. public static var outputFacility: OutputFacility = ConsoleOutputFacility() - + /// A class of the URL protocol used to intercept requests. public static let URLProtocolClass: Foundation.URLProtocol.Type = URLProtocol.self - + /// A storage for request predicates. private static var requestPredicates: [NSPredicate] = [] @@ -36,7 +36,7 @@ import Foundation ] // MARK: Configuration - + /// Resets the ResponseDetective mutable state. public static func reset() { outputFacility = ConsoleOutputFacility() @@ -52,7 +52,7 @@ import Foundation @objc(enableInConfiguration:) public static func enable(inConfiguration configuration: URLSessionConfiguration) { configuration.protocolClasses?.insert(URLProtocolClass, at: 0) } - + /// Ignores requests matching the given predicate. The predicate will be /// evaluated with an instance of NSURLRequest. /// @@ -85,7 +85,7 @@ import Foundation @objc(registerBodyDeserializer:forContentType:) public static func registerBodyDeserializer(_ deserializer: BodyDeserializer, forContentType contentType: String) { customBodyDeserializers[contentType] = deserializer } - + /// Registers a body deserializer. /// /// - Parameters: diff --git a/ResponseDetective/Sources/ResponseRepresentation.swift b/ResponseDetective/Sources/ResponseRepresentation.swift index e4cb289..61544f6 100644 --- a/ResponseDetective/Sources/ResponseRepresentation.swift +++ b/ResponseDetective/Sources/ResponseRepresentation.swift @@ -1,7 +1,7 @@ // // ResponseRepresentation.swift // -// Copyright © 2016-2017 Netguru Sp. z o.o. All rights reserved. +// Copyright © 2016-2020 Netguru S.A. All rights reserved. // Licensed under the MIT License. // @@ -29,7 +29,7 @@ import Foundation self.body = body self.deserializedBody = deserializedBody } - + /// Initializes the receiver. /// /// - Parameters: @@ -49,34 +49,34 @@ import Foundation } // MARK: Properties - + /// The request's unique identifier. public let requestIdentifier: String - + /// The status code of the response. public let statusCode: Int - + /// A verbal representation of the status code. public var statusString: String { return HTTPURLResponse.localizedString(forStatusCode: statusCode) } - + /// The URL string of the response (which may be different than originally /// requested because of a redirect). public let urlString: String - + /// The HTTP headers of the response. public let headers: [String: String] - + /// The content type of the response. public var contentType: String { return headers["Content-Type"] ?? "application/octet-stream" } - + /// The raw body data of the response. public let body: Data? - + /// The parsed body of the response. public let deserializedBody: String? - + } diff --git a/ResponseDetective/Sources/URLEncodedBodyDeserializer.swift b/ResponseDetective/Sources/URLEncodedBodyDeserializer.swift index bed91d4..91f7e4c 100644 --- a/ResponseDetective/Sources/URLEncodedBodyDeserializer.swift +++ b/ResponseDetective/Sources/URLEncodedBodyDeserializer.swift @@ -1,7 +1,7 @@ // // URLEncodedBodyDeserializer.swift // -// Copyright © 2016-2017 Netguru Sp. z o.o. All rights reserved. +// Copyright © 2016-2020 Netguru S.A. All rights reserved. // Licensed under the MIT License. // diff --git a/ResponseDetective/Sources/URLProtocol.swift b/ResponseDetective/Sources/URLProtocol.swift index 15e5ebb..1134e5e 100644 --- a/ResponseDetective/Sources/URLProtocol.swift +++ b/ResponseDetective/Sources/URLProtocol.swift @@ -1,7 +1,7 @@ // // URLProtocol.swift // -// Copyright © 2016-2017 Netguru Sp. z o.o. All rights reserved. +// Copyright © 2016-2020 Netguru S.A. All rights reserved. // Licensed under the MIT License. // @@ -26,21 +26,21 @@ import Foundation } // MARK: Properties - + /// Internal session object used to perform the request. private var internalSession: Foundation.URLSession! - + /// Internal session data dark responsible for request execution. private var internalTask: URLSessionDataTask! - + /// Internal task response storage. private var internalResponse: HTTPURLResponse? - + /// Internal response data storage. private lazy var internalResponseData = Data() - /// A unique identifier of the request. Currently its address. - private lazy var requestIdentifier: String = String(describing: Unmanaged.passUnretained(self.internalTask.originalRequest! as AnyObject).toOpaque()) + /// A unique identifier of the request. + private let requestIdentifier: String = UUID().uuidString.uppercased() // MARK: URLProtocol @@ -78,7 +78,7 @@ import Foundation } internalSession.finishTasksAndInvalidate() } - + // MARK: URLSessionDataDelegate /// - SeeAlso: URLSessionDataDelegate.urlSession(_:dataTask:didReceive:completionHandler:) @@ -95,7 +95,7 @@ import Foundation } // MARK: Interception - + /// Incercepts the given request and passes it to the ResponseDetective /// instance. /// @@ -143,7 +143,7 @@ import Foundation } // MARK: Private - + /// Extracts and standardizes data of a request. /// /// - Parameters: @@ -163,5 +163,5 @@ import Foundation return data as Data } } - + } diff --git a/ResponseDetective/Tests/Additions/TestBodyDeserializer.swift b/ResponseDetective/Tests/Additions/TestBodyDeserializer.swift index 89b5787..598a84e 100644 --- a/ResponseDetective/Tests/Additions/TestBodyDeserializer.swift +++ b/ResponseDetective/Tests/Additions/TestBodyDeserializer.swift @@ -1,7 +1,7 @@ // // TestBodyDeserializer.swift // -// Copyright © 2016-2017 Netguru Sp. z o.o. All rights reserved. +// Copyright © 2016-2020 Netguru S.A. All rights reserved. // Licensed under the MIT License. // diff --git a/ResponseDetective/Tests/Specs/BufferOutputFacilitySpec.swift b/ResponseDetective/Tests/Specs/BufferOutputFacilitySpec.swift index 88acdbb..c0544d5 100644 --- a/ResponseDetective/Tests/Specs/BufferOutputFacilitySpec.swift +++ b/ResponseDetective/Tests/Specs/BufferOutputFacilitySpec.swift @@ -1,7 +1,7 @@ // // BufferOutputFacilitySpec.swift // -// Copyright © 2016-2017 Netguru Sp. z o.o. All rights reserved. +// Copyright © 2016-2020 Netguru S.A. All rights reserved. // Licensed under the MIT License. // diff --git a/ResponseDetective/Tests/Specs/ConsoleOutputFacilitySpec.swift b/ResponseDetective/Tests/Specs/ConsoleOutputFacilitySpec.swift index 72eb7f8..c04ee1c 100644 --- a/ResponseDetective/Tests/Specs/ConsoleOutputFacilitySpec.swift +++ b/ResponseDetective/Tests/Specs/ConsoleOutputFacilitySpec.swift @@ -1,7 +1,7 @@ // // ConsoleOutputFacilitySpec.swift // -// Copyright © 2016-2017 Netguru Sp. z o.o. All rights reserved. +// Copyright © 2016-2020 Netguru S.A. All rights reserved. // Licensed under the MIT License. // @@ -72,7 +72,7 @@ internal final class ConsoleOutputFacilitySpec: QuickSpec { } } - + } - + } diff --git a/ResponseDetective/Tests/Specs/ErrorRepresentationSpec.swift b/ResponseDetective/Tests/Specs/ErrorRepresentationSpec.swift index bfe4a18..427bcda 100644 --- a/ResponseDetective/Tests/Specs/ErrorRepresentationSpec.swift +++ b/ResponseDetective/Tests/Specs/ErrorRepresentationSpec.swift @@ -1,7 +1,7 @@ // // ErrorRepresentationSpec.swift // -// Copyright © 2016-2017 Netguru Sp. z o.o. All rights reserved. +// Copyright © 2016-2020 Netguru S.A. All rights reserved. // Licensed under the MIT License. // @@ -11,20 +11,20 @@ import ResponseDetective import Quick internal final class ErrorRepresentationSpec: QuickSpec { - + override func spec() { - + describe("ErrorRepresentation") { - + context("after initializing with an error") { - + let fixtureIdentifier = "1" - + let fixtureError = NSError(domain: NSURLErrorDomain, code: NSURLErrorNotConnectedToInternet, userInfo: [ NSLocalizedDescriptionKey: "The connection failed because the device is not connected to the internet.", NSURLErrorKey: NSURL(string: "https://httpbin.org/post")! ]) - + let fixtureResponse = ResponseRepresentation( requestIdentifier: fixtureIdentifier, response: HTTPURLResponse( @@ -39,41 +39,41 @@ internal final class ErrorRepresentationSpec: QuickSpec { body: nil, deserializedBody: nil ) - + var sut: ErrorRepresentation! - + beforeEach { sut = ErrorRepresentation(requestIdentifier: fixtureIdentifier, error: fixtureError, response: fixtureResponse) } - + it("should have a correct identifier") { expect(sut.requestIdentifier).to(equal(fixtureIdentifier)) } - + it("should have a correct response") { expect(sut.response).to(beIdenticalTo(fixtureResponse)) } - + it("should have a correct domain") { expect(sut.domain).to(equal(fixtureError.domain)) } - + it("should have a correct code") { expect(sut.code).to(equal(fixtureError.code)) } - + it("should have a correct reason") { expect(sut.reason).to(equal(fixtureError.localizedDescription)) } - + it("should have correct user info") { expect(sut.userInfo as? [String: NSObject]).to(equal(fixtureError.userInfo as? [String: NSObject])) } - + } - + } - + } - + } diff --git a/ResponseDetective/Tests/Specs/HTMLBodyDeserializerSpec.swift b/ResponseDetective/Tests/Specs/HTMLBodyDeserializerSpec.swift index 43bb032..08dc854 100644 --- a/ResponseDetective/Tests/Specs/HTMLBodyDeserializerSpec.swift +++ b/ResponseDetective/Tests/Specs/HTMLBodyDeserializerSpec.swift @@ -1,7 +1,7 @@ // // HTMLBodyDeserializerSpec.swift // -// Copyright © 2016-2017 Netguru Sp. z o.o. All rights reserved. +// Copyright © 2016-2020 Netguru S.A. All rights reserved. // Licensed under the MIT License. // @@ -26,7 +26,7 @@ internal final class HTMLBodyDeserializerSpec: QuickSpec { } } - + } - + } diff --git a/ResponseDetective/Tests/Specs/ImageBodyDeserializerSpec.swift b/ResponseDetective/Tests/Specs/ImageBodyDeserializerSpec.swift index 50a3f40..34cc885 100644 --- a/ResponseDetective/Tests/Specs/ImageBodyDeserializerSpec.swift +++ b/ResponseDetective/Tests/Specs/ImageBodyDeserializerSpec.swift @@ -1,7 +1,7 @@ // // ImageBodyDeserializerSpec.swift // -// Copyright © 2016-2017 Netguru Sp. z o.o. All rights reserved. +// Copyright © 2016-2020 Netguru S.A. All rights reserved. // Licensed under the MIT License. // @@ -28,7 +28,7 @@ internal final class ImageBodyDeserializerSpec: QuickSpec { } } - + } // MARK: - diff --git a/ResponseDetective/Tests/Specs/JSONBodyDeserializerSpec.swift b/ResponseDetective/Tests/Specs/JSONBodyDeserializerSpec.swift index ab08d6b..940b95d 100644 --- a/ResponseDetective/Tests/Specs/JSONBodyDeserializerSpec.swift +++ b/ResponseDetective/Tests/Specs/JSONBodyDeserializerSpec.swift @@ -1,7 +1,7 @@ // // JSONBodyDeserializerSpec.swift // -// Copyright © 2016-2017 Netguru Sp. z o.o. All rights reserved. +// Copyright © 2016-2020 Netguru S.A. All rights reserved. // Licensed under the MIT License. // @@ -11,9 +11,9 @@ import ResponseDetective import Quick internal final class JSONBodyDeserializerSpec: QuickSpec { - + override func spec() { - + describe("JSONBodyDeserializer") { let sut = JSONBodyDeserializer() @@ -26,9 +26,9 @@ internal final class JSONBodyDeserializerSpec: QuickSpec { expect { (actualJSON as NSDictionary) }.to(equal(source as NSDictionary)) } - + } - + } - + } diff --git a/ResponseDetective/Tests/Specs/PlaintextBodyDeserializerSpec.swift b/ResponseDetective/Tests/Specs/PlaintextBodyDeserializerSpec.swift index ed04e4d..76807ba 100644 --- a/ResponseDetective/Tests/Specs/PlaintextBodyDeserializerSpec.swift +++ b/ResponseDetective/Tests/Specs/PlaintextBodyDeserializerSpec.swift @@ -1,7 +1,7 @@ // // PlaintextBodyDeserializerSpec.swift // -// Copyright © 2016-2017 Netguru Sp. z o.o. All rights reserved. +// Copyright © 2016-2020 Netguru S.A. All rights reserved. // Licensed under the MIT License. // @@ -11,9 +11,9 @@ import ResponseDetective import Quick internal final class PlaintextBodyDeserializerSpec: QuickSpec { - + override func spec() { - + describe("PlaintextBodyDeserializer") { let sut = PlaintextBodyDeserializer() @@ -24,9 +24,9 @@ internal final class PlaintextBodyDeserializerSpec: QuickSpec { let expected = source expect { sut.deserialize(body: data) }.to(equal(expected)) } - + } - + } - + } diff --git a/ResponseDetective/Tests/Specs/RequestRepresentationSpec.swift b/ResponseDetective/Tests/Specs/RequestRepresentationSpec.swift index fb5e85e..70cada3 100644 --- a/ResponseDetective/Tests/Specs/RequestRepresentationSpec.swift +++ b/ResponseDetective/Tests/Specs/RequestRepresentationSpec.swift @@ -1,7 +1,7 @@ // // RequestRepresentationSpec.swift // -// Copyright © 2016-2017 Netguru Sp. z o.o. All rights reserved. +// Copyright © 2016-2020 Netguru S.A. All rights reserved. // Licensed under the MIT License. // @@ -11,13 +11,13 @@ import ResponseDetective import Quick internal final class RequestRepresentationSpec: QuickSpec { - + override func spec() { - + describe("RequestRepresentation") { - + context("after initializing with a request") { - + let fixtureRequest = NSMutableURLRequest( URL: URL(string: "https://httpbin.org/post")!, HTTPMethod: "POST", @@ -27,37 +27,37 @@ internal final class RequestRepresentationSpec: QuickSpec { ], HTTPBody: try! JSONSerialization.data(withJSONObject: ["foo": "bar"], options: []) ) - + let fixtureIdentifier = "1" - + var sut: RequestRepresentation! - + beforeEach { sut = RequestRepresentation(identifier: fixtureIdentifier, request: fixtureRequest as URLRequest, deserializedBody: nil) } - + it("should have a correct identifier") { expect(sut.identifier).to(equal(fixtureIdentifier)) } - + it("should have a correct URLString") { expect(sut.urlString).to(equal(fixtureRequest.url!.absoluteString)) } - + it("should have a correct method") { expect(sut.method).to(equal(fixtureRequest.httpMethod)) } - + it("should have correct headers") { expect(sut.headers).to(equal(fixtureRequest.allHTTPHeaderFields)) } - + it("should have a correct body") { expect(sut.body).to(equal(fixtureRequest.httpBody)) } - + } - + } } diff --git a/ResponseDetective/Tests/Specs/ResponseDetectiveSpec.swift b/ResponseDetective/Tests/Specs/ResponseDetectiveSpec.swift index 4b2d3bd..9eb839f 100644 --- a/ResponseDetective/Tests/Specs/ResponseDetectiveSpec.swift +++ b/ResponseDetective/Tests/Specs/ResponseDetectiveSpec.swift @@ -1,7 +1,7 @@ // // ResponseDetectiveSpec.swift // -// Copyright © 2016-2017 Netguru Sp. z o.o. All rights reserved. +// Copyright © 2016-2020 Netguru S.A. All rights reserved. // Licensed under the MIT License. // @@ -12,25 +12,25 @@ import ResponseDetective import Quick internal final class ResponseDetectiveSpec: QuickSpec { - + override func spec() { - + describe("ResponseDetective") { - + beforeSuite { stub(condition: isHost("httpbin.org")) { _ in return OHHTTPStubsResponse(data: Data(), statusCode: 200, headers: nil) } } - + beforeEach { ResponseDetective.reset() } - + afterSuite { OHHTTPStubs.removeAllStubs() } - + describe("initial state") { it("should use default output facility") { @@ -79,7 +79,7 @@ internal final class ResponseDetectiveSpec: QuickSpec { return true } let string = url.absoluteString - + return string.contains("foo") }) } @@ -261,7 +261,7 @@ internal final class ResponseDetectiveSpec: QuickSpec { } } - + } } diff --git a/ResponseDetective/Tests/Specs/ResponseRepresentationSpec.swift b/ResponseDetective/Tests/Specs/ResponseRepresentationSpec.swift index c8b50bc..34ad105 100644 --- a/ResponseDetective/Tests/Specs/ResponseRepresentationSpec.swift +++ b/ResponseDetective/Tests/Specs/ResponseRepresentationSpec.swift @@ -1,7 +1,7 @@ // // ResponseRepresentationSpec.swift // -// Copyright © 2016-2017 Netguru Sp. z o.o. All rights reserved. +// Copyright © 2016-2020 Netguru S.A. All rights reserved. // Licensed under the MIT License. // @@ -11,13 +11,13 @@ import ResponseDetective import Quick internal final class ResponseRepresentationSpec: QuickSpec { - + override func spec() { - + describe("ResponseRepresentation") { - + context("after initializing with a response") { - + let fixtureResponse = HTTPURLResponse( url: URL(string: "https://httpbin.org/post")!, statusCode: 200, @@ -27,40 +27,40 @@ internal final class ResponseRepresentationSpec: QuickSpec { "X-Foo": "bar" ] )! - + let fixtureBody = try! JSONSerialization.data(withJSONObject: ["foo": "bar"], options: []) let fixtureIdentifier = "1" - + var sut: ResponseRepresentation! - + beforeEach { sut = ResponseRepresentation(requestIdentifier: fixtureIdentifier, response: fixtureResponse, body: fixtureBody, deserializedBody: nil) } - + it("should have a correct identifier") { expect(sut.requestIdentifier).to(equal(fixtureIdentifier)) } - + it("should have a correct URLString") { expect(sut.urlString).to(equal(fixtureResponse.url!.absoluteString)) } - + it("should have a correct method") { expect(sut.statusCode).to(equal(fixtureResponse.statusCode)) } - + it("should have correct headers") { expect(sut.headers).to(equal(fixtureResponse.allHeaderFields as? [String: String])) } - + it("should have a correct body") { expect(sut.body).to(equal(fixtureBody)) } - + } - + } - + } - + } diff --git a/ResponseDetective/Tests/Specs/URLEncodedBodyDeserializerSpec.swift b/ResponseDetective/Tests/Specs/URLEncodedBodyDeserializerSpec.swift index 5a3a76f..25ed555 100644 --- a/ResponseDetective/Tests/Specs/URLEncodedBodyDeserializerSpec.swift +++ b/ResponseDetective/Tests/Specs/URLEncodedBodyDeserializerSpec.swift @@ -1,7 +1,7 @@ // // URLEncodedBodyDeserializerSpec.swift // -// Copyright © 2016-2017 Netguru Sp. z o.o. All rights reserved. +// Copyright © 2016-2020 Netguru S.A. All rights reserved. // Licensed under the MIT License. // @@ -43,9 +43,9 @@ internal final class URLEncodedBodyDeserializerSpec: QuickSpec { } } - + } - + } // MARK: - diff --git a/ResponseDetective/Tests/Specs/XMLBodyDeserializerSpec.swift b/ResponseDetective/Tests/Specs/XMLBodyDeserializerSpec.swift index 6ea4af1..30c396a 100644 --- a/ResponseDetective/Tests/Specs/XMLBodyDeserializerSpec.swift +++ b/ResponseDetective/Tests/Specs/XMLBodyDeserializerSpec.swift @@ -1,7 +1,7 @@ // // XMLBodyDeserializerSpec.swift // -// Copyright © 2016-2017 Netguru Sp. z o.o. All rights reserved. +// Copyright © 2016-2020 Netguru S.A. All rights reserved. // Licensed under the MIT License. // @@ -28,5 +28,5 @@ internal final class XMLBodyDeserializerSpec: QuickSpec { } } - + } diff --git a/bitrise.yml b/bitrise.yml index 3ec88b6..5f488bb 100644 --- a/bitrise.yml +++ b/bitrise.yml @@ -1,7 +1,7 @@ # # bitrise.yml # -# Copyright © 2017 Netguru Sp. z o.o. All rights reserved. +# Copyright © 2017-2020 Netguru S.A. All rights reserved. # Licensed under the MIT License. #