Skip to content

Commit

Permalink
Support Swift 5.0 (#123)
Browse files Browse the repository at this point in the history
* Update Swish for Swift 5.0.

Using the latest Quick and Nimble was pretty much the only code change
required.

We no longer need a framework for Result (even though this is was a good
one). It's included in the standard library now, so the only thing we
needed was an extension to add value and error to keep the tests happy
(and anyone who was depending on those in their code).

* Adjust from feedback.

Needed to ignore a new file and I was incorrectly creating a new decoder
in my fix (not sure how this worked in my tests like this).

* Removing the need for Result.

Now that Swift 5 provides this, we don't need it.

* Eliminate Result extension.

This caused the compiler to crash initially because there's so much type
inferrence going on in the tests that it couldn't even report errors. I
think I got it worked out to keep the intent behind the test without
having the `value` and `error` fields.
  • Loading branch information
sgoodwin authored and sidraval committed Jun 7, 2019
1 parent 2dcbe67 commit ea24036
Show file tree
Hide file tree
Showing 28 changed files with 84 additions and 112 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,3 @@ Carthage/Build
.idea/
*.iml

Argo.framework.zip
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "Carthage/Checkouts/Result"]
path = Carthage/Checkouts/Result
url = https://github.com/antitypical/Result.git
[submodule "Carthage/Checkouts/Nimble"]
path = Carthage/Checkouts/Nimble
url = https://github.com/Quick/Nimble.git
Expand Down
1 change: 0 additions & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
github "antitypical/Result" ~> 4.0
4 changes: 2 additions & 2 deletions Cartfile.private
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github "Quick/Quick" ~> 1.3
github "Quick/Nimble" ~> 7.0
github "Quick/Quick" ~> 2.0
github "Quick/Nimble" ~> 8.0
5 changes: 2 additions & 3 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
github "Quick/Nimble" "v7.3.1"
github "Quick/Quick" "v1.3.2"
github "antitypical/Result" "4.0.0"
github "Quick/Nimble" "v8.0.1"
github "Quick/Quick" "v2.1.0"
2 changes: 1 addition & 1 deletion Carthage/Checkouts/Nimble
Submodule Nimble updated 97 files
+1 −1 .swift-version
+16 −4 .swiftlint.yml
+28 −27 .travis.yml
+1 −1 Gemfile
+24 −24 Gemfile.lock
+4 −1 Nimble.podspec
+24 −4 Nimble.xcodeproj/project.pbxproj
+8 −0 Nimble.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
+16 −6 Package.swift
+0 −22 [email protected]
+7 −22 README.md
+1 −0 Sources/Nimble/Adapters/AdapterProtocols.swift
+30 −3 Sources/Nimble/Adapters/AssertionRecorder.swift
+5 −1 Sources/Nimble/Adapters/NMBExpectation.swift
+3 −1 Sources/Nimble/Adapters/NMBObjCMatcher.swift
+8 −10 Sources/Nimble/Adapters/NimbleEnvironment.swift
+6 −7 Sources/Nimble/Adapters/NimbleXCTestHandler.swift
+1 −1 Sources/Nimble/Adapters/NonObjectiveC/ExceptionCapture.swift
+10 −4 Sources/Nimble/DSL+Wait.swift
+11 −7 Sources/Nimble/DSL.swift
+16 −13 Sources/Nimble/ExpectationMessage.swift
+2 −0 Sources/Nimble/Expression.swift
+1 −0 Sources/Nimble/FailureMessage.swift
+2 −1 Sources/Nimble/Matchers/AllPass.swift
+10 −4 Sources/Nimble/Matchers/Async.swift
+1 −1 Sources/Nimble/Matchers/BeAKindOf.swift
+2 −2 Sources/Nimble/Matchers/BeAnInstanceOf.swift
+8 −1 Sources/Nimble/Matchers/BeCloseTo.swift
+25 −4 Sources/Nimble/Matchers/BeEmpty.swift
+4 −4 Sources/Nimble/Matchers/BeGreaterThan.swift
+4 −4 Sources/Nimble/Matchers/BeGreaterThanOrEqualTo.swift
+6 −6 Sources/Nimble/Matchers/BeIdenticalTo.swift
+4 −4 Sources/Nimble/Matchers/BeLessThan.swift
+4 −4 Sources/Nimble/Matchers/BeLessThanOrEqual.swift
+17 −30 Sources/Nimble/Matchers/BeLogical.swift
+4 −4 Sources/Nimble/Matchers/BeNil.swift
+7 −5 Sources/Nimble/Matchers/BeVoid.swift
+8 −8 Sources/Nimble/Matchers/BeginWith.swift
+66 −17 Sources/Nimble/Matchers/Contain.swift
+13 −13 Sources/Nimble/Matchers/ContainElementSatisfying.swift
+16 −0 Sources/Nimble/Matchers/ElementsEqual.swift
+7 −6 Sources/Nimble/Matchers/EndWith.swift
+42 −114 Sources/Nimble/Matchers/Equal.swift
+18 −9 Sources/Nimble/Matchers/HaveCount.swift
+1 −1 Sources/Nimble/Matchers/Match.swift
+8 −5 Sources/Nimble/Matchers/MatcherProtocols.swift
+5 −32 Sources/Nimble/Matchers/PostNotification.swift
+3 −2 Sources/Nimble/Matchers/Predicate.swift
+9 −3 Sources/Nimble/Matchers/RaisesException.swift
+7 −3 Sources/Nimble/Matchers/SatisfyAllOf.swift
+7 −3 Sources/Nimble/Matchers/SatisfyAnyOf.swift
+3 −4 Sources/Nimble/Matchers/ThrowAssertion.swift
+13 −19 Sources/Nimble/Utils/Await.swift
+4 −2 Sources/Nimble/Utils/Functional.swift
+3 −2 Sources/Nimble/Utils/Stringers.swift
+4 −33 Tests/LinuxMain.swift
+15 −53 Tests/NimbleTests/AsynchronousTest.swift
+15 −5 Tests/NimbleTests/Helpers/XCTestCaseProvider.swift
+7 −2 Tests/NimbleTests/Helpers/utils.swift
+0 −11 Tests/NimbleTests/Matchers/AllPassTest.swift
+4 −18 Tests/NimbleTests/Matchers/BeAKindOfTest.swift
+0 −9 Tests/NimbleTests/Matchers/BeAnInstanceOfTest.swift
+18 −36 Tests/NimbleTests/Matchers/BeCloseToTest.swift
+66 −14 Tests/NimbleTests/Matchers/BeEmptyTest.swift
+0 −7 Tests/NimbleTests/Matchers/BeGreaterThanOrEqualToTest.swift
+0 −7 Tests/NimbleTests/Matchers/BeGreaterThanTest.swift
+0 −11 Tests/NimbleTests/Matchers/BeIdenticalToObjectTest.swift
+0 −11 Tests/NimbleTests/Matchers/BeIdenticalToTest.swift
+0 −7 Tests/NimbleTests/Matchers/BeLessThanOrEqualToTest.swift
+0 −7 Tests/NimbleTests/Matchers/BeLessThanTest.swift
+0 −38 Tests/NimbleTests/Matchers/BeLogicalTest.swift
+0 −6 Tests/NimbleTests/Matchers/BeNilTest.swift
+0 −6 Tests/NimbleTests/Matchers/BeVoidTest.swift
+0 −7 Tests/NimbleTests/Matchers/BeginWithTest.swift
+0 −14 Tests/NimbleTests/Matchers/ContainElementSatisfyingTest.swift
+62 −12 Tests/NimbleTests/Matchers/ContainTest.swift
+27 −0 Tests/NimbleTests/Matchers/ElementsEqualTest.swift
+0 −7 Tests/NimbleTests/Matchers/EndWithTest.swift
+1 −18 Tests/NimbleTests/Matchers/EqualTest.swift
+39 −20 Tests/NimbleTests/Matchers/HaveCountTest.swift
+4 −12 Tests/NimbleTests/Matchers/MatchErrorTest.swift
+0 −10 Tests/NimbleTests/Matchers/MatchTest.swift
+0 −12 Tests/NimbleTests/Matchers/PostNotificationTest.swift
+1 −11 Tests/NimbleTests/Matchers/RaisesExceptionTest.swift
+0 −7 Tests/NimbleTests/Matchers/SatisfyAllOfTest.swift
+0 −7 Tests/NimbleTests/Matchers/SatisfyAnyOfTest.swift
+1 −12 Tests/NimbleTests/Matchers/ThrowAssertionTest.swift
+2 −12 Tests/NimbleTests/Matchers/ThrowErrorTest.swift
+0 −6 Tests/NimbleTests/Matchers/ToSucceedTest.swift
+0 −19 Tests/NimbleTests/SynchronousTest.swift
+36 −29 Tests/NimbleTests/UserDescriptionTest.swift
+387 −0 Tests/NimbleTests/XCTestManifests.swift
+5 −0 Tests/NimbleTests/objc/ObjCAsyncTest.m
+9 −0 Tests/NimbleTests/objc/ObjCContainTest.m
+0 −1 Tests/NimbleTests/objc/ObjCEndWithTest.m
+9 −0 Tests/NimbleTests/objc/ObjCHaveCountTest.m
+7 −3 test
2 changes: 1 addition & 1 deletion Carthage/Checkouts/Quick
Submodule Quick updated 68 files
+4 −2 .hound.yml
+1 −1 .swift-version
+48 −44 .travis.yml
+2 −2 Dangerfile
+1 −1 Documentation/en-us/SharedExamples.md
+1 −1 Documentation/ko-kr/BehavioralTesting.md
+1 −1 Documentation/ko-kr/InstallingQuick.md
+1 −1 Externals/Nimble
+1 −1 Gemfile
+48 −44 Gemfile.lock
+2 −2 Package.resolved
+35 −37 Package.swift
+6 −4 [email protected]
+1 −1 Quick Templates/Quick Configuration Class.xctemplate/Objective-C/___FILEBASENAME___.h
+1 −1 Quick Templates/Quick Configuration Class.xctemplate/Objective-C/___FILEBASENAME___.m
+1 −1 Quick Templates/Quick Configuration Class.xctemplate/Swift/___FILEBASENAME___.swift
+1 −1 Quick Templates/Quick Spec Class.xctemplate/Objective-C/___FILEBASENAME___.m
+1 −1 Quick Templates/Quick Spec Class.xctemplate/Swift/___FILEBASENAME___.swift
+5 −2 Quick.podspec
+75 −42 Quick.xcodeproj/project.pbxproj
+1 −1 Quick.xcodeproj/xcshareddata/xcschemes/Quick-iOS.xcscheme
+1 −1 Quick.xcodeproj/xcshareddata/xcschemes/Quick-macOS.xcscheme
+1 −1 Quick.xcodeproj/xcshareddata/xcschemes/Quick-tvOS.xcscheme
+8 −0 Quick.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
+3 −1 README.md
+9 −6 Rakefile
+1 −1 Sources/Quick/Behavior.swift
+17 −12 Sources/Quick/Callsite.swift
+2 −2 Sources/Quick/Configuration/Configuration.swift
+1 −1 Sources/Quick/Configuration/QuickConfiguration.swift
+10 −10 Sources/Quick/DSL/DSL.swift
+15 −15 Sources/Quick/DSL/World+DSL.swift
+1 −1 Sources/Quick/ErrorUtility.swift
+3 −9 Sources/Quick/Example.swift
+3 −9 Sources/Quick/ExampleMetadata.swift
+3 −9 Sources/Quick/Filter.swift
+2 −2 Sources/Quick/NSBundle+CurrentTestBundle.swift
+2 −2 Sources/Quick/QuickMain.swift
+1 −1 Sources/Quick/QuickSelectedTestSuiteBuilder.swift
+24 −16 Sources/Quick/QuickSpec.swift
+1 −1 Sources/Quick/QuickTestSuite.swift
+4 −7 Sources/Quick/String+C99ExtendedIdentifier.swift
+5 −11 Sources/Quick/World.swift
+1 −1 Sources/QuickObjectiveC/QuickSpec.h
+16 −15 Tests/LinuxMain.swift
+3 −2 Tests/QuickTests/QuickTestHelpers/SpecRunner.swift
+3 −8 Tests/QuickTests/QuickTestHelpers/TestRun.swift
+5 −5 Tests/QuickTests/QuickTestHelpers/XCTestCaseProvider.swift
+1 −1 Tests/QuickTests/QuickTests/FunctionalTests/AfterEachTests.swift
+1 −1 Tests/QuickTests/QuickTests/FunctionalTests/BeforeEachTests.swift
+1 −1 Tests/QuickTests/QuickTests/FunctionalTests/BehaviorTests.swift
+1 −1 Tests/QuickTests/QuickTests/FunctionalTests/ContextTests.swift
+18 −6 Tests/QuickTests/QuickTests/FunctionalTests/CurrentSpecTests.swift
+1 −1 Tests/QuickTests/QuickTests/FunctionalTests/DescribeTests.swift
+2 −2 Tests/QuickTests/QuickTests/FunctionalTests/ItTests.swift
+1 −1 Tests/QuickTests/QuickTests/FunctionalTests/ObjC/ItTests+ObjC.m
+1 −1 Tests/QuickTests/QuickTests/FunctionalTests/SharedExamplesTests.swift
+8 −23 Tests/QuickTests/QuickTests/Helpers/QCKSpecRunner.m
+24 −0 Tests/QuickTests/QuickTests/Helpers/QuickSpec+MethodList.swift
+0 −17 Tests/QuickTests/QuickTests/Helpers/QuickSpec+QuickSpec_MethodList.h
+0 −23 Tests/QuickTests/QuickTests/Helpers/QuickSpec+QuickSpec_MethodList.m
+57 −0 Tests/QuickTests/QuickTests/Helpers/QuickSpecRunner.swift
+1 −2 Tests/QuickTests/QuickTests/Helpers/QuickTestsBridgingHeader.h
+0 −20 Tests/QuickTests/QuickTests/Helpers/XCTestObservationCenter+QCKSuspendObservation.h
+0 −54 Tests/QuickTests/QuickTests/Helpers/XCTestObservationCenter+QCKSuspendObservation.m
+47 −0 Tests/QuickTests/QuickTests/Helpers/XCTestObservationCenter+QCKSuspendObservation.swift
+1 −1 script/release
+0 −4 script/travis-install-macos
1 change: 0 additions & 1 deletion Carthage/Checkouts/Result
Submodule Result deleted from 8fc088
1 change: 0 additions & 1 deletion Source/Models/APIClient.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Foundation
import Result

public struct APIClient {
fileprivate let requestPerformer: RequestPerformer
Expand Down
1 change: 0 additions & 1 deletion Source/Models/NetworkRequestPerformer.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Foundation
import Result

public struct NetworkRequestPerformer: RequestPerformer {
fileprivate let session: URLSession
Expand Down
1 change: 0 additions & 1 deletion Source/Protocols/Client.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Foundation
import Result

public protocol Client {
@discardableResult
Expand Down
1 change: 0 additions & 1 deletion Source/Protocols/Request.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Foundation
import Result

public typealias EmptyResponse = Void

Expand Down
1 change: 0 additions & 1 deletion Source/Protocols/RequestPerformer.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Foundation
import Result

public protocol RequestPerformer {
@discardableResult
Expand Down
72 changes: 22 additions & 50 deletions Swish.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Swish.xcodeproj/xcshareddata/xcschemes/Swish-Mac.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
3 changes: 2 additions & 1 deletion Swish.xcodeproj/xcshareddata/xcschemes/Swish-iOS.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
codeCoverageEnabled = "YES"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down
2 changes: 1 addition & 1 deletion Swish.xcodeproj/xcshareddata/xcschemes/Swish-tvOS.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
3 changes: 0 additions & 3 deletions Swish.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Swish.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
1 change: 0 additions & 1 deletion SwishExamples.playground/Contents.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import PlaygroundSupport
import Swish
import Result

PlaygroundPage.current.needsIndefiniteExecution = true

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
1 change: 0 additions & 1 deletion Tests/Fakes/FakeRequest.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Foundation
import Swish
import Result

struct FakeRequest: Request {
typealias ResponseObject = String
Expand Down
1 change: 0 additions & 1 deletion Tests/Fakes/FakeRequestPerformer.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Foundation
import Swish
import Result

enum ResponseData {
case data(Data)
Expand Down
1 change: 0 additions & 1 deletion Tests/Helpers/NimbleMatchers.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Nimble
import Result

public func beVoid() -> MatcherFunc<Void> {
return MatcherFunc { actualExpression, failureMessage in
Expand Down
55 changes: 28 additions & 27 deletions Tests/Tests/APIClientSpec.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Swish
import Quick
import Nimble
import Result

class APIClientSpec: QuickSpec {
override func spec() {
Expand Down Expand Up @@ -32,8 +31,8 @@ class APIClientSpec: QuickSpec {
var result: Result<String, SwishError>?

client.perform(request) { result = $0 }

expect(result?.value).toEventually(equal("hello world"))
expect { try result?.get() }.toEventually(equal("hello world"))
}
}

Expand All @@ -45,10 +44,12 @@ class APIClientSpec: QuickSpec {
)

let client = APIClient(requestPerformer: performer)
var error: Error?
var error: SwishError?

client.perform(request) {
error = $0.error
client.perform(request) { result in
if case let .failure(resultError) = result {
error = resultError
}
}

expect(error).toEventually(matchError(SwishError.self))
Expand All @@ -66,8 +67,8 @@ class APIClientSpec: QuickSpec {
var result: Result<EmptyResponse, SwishError>?

client.perform(request) { result = $0 }

expect(result?.value).toEventually(beVoid())
expect { try result?.get() }.toEventually(beVoid())
}
}

Expand All @@ -82,8 +83,8 @@ class APIClientSpec: QuickSpec {
var result: Result<EmptyResponse, SwishError>?

client.perform(request) { result = $0 }

expect(result?.value).toEventually(beVoid())
expect { try result?.get() }.toEventually(beVoid())
}
}
}
Expand Down Expand Up @@ -119,13 +120,13 @@ class APIClientSpec: QuickSpec {
)

let client = APIClient(requestPerformer: performer)
var error: SwishError?

var result: Result<String, SwishError>?
client.perform(request) {
error = $0.error
result = $0
}

expect(error).toEventually(matchError(SwishError.serverError(code: expectedCode, data: performer.data)))
expect { try result?.get() }.toEventually(throwError(SwishError.serverError(code: expectedCode, data: performer.data)))
}
}

Expand All @@ -140,13 +141,13 @@ class APIClientSpec: QuickSpec {
)

let client = APIClient(requestPerformer: performer)
var error: SwishError?
var result: Result<String, SwishError>?

client.perform(request) {
error = $0.error
result = $0
}

expect(error).toEventually(matchError(SwishError.serverError(code: expectedCode, data: performer.data)))
expect { try result?.get() }.toEventually(throwError(SwishError.serverError(code: expectedCode, data: performer.data)))
}
}

Expand All @@ -161,13 +162,13 @@ class APIClientSpec: QuickSpec {
)

let client = APIClient(requestPerformer: performer)
var error: SwishError?
var result: Result<String, SwishError>?

client.perform(request) {
error = $0.error
result = $0
}

expect(error).toEventually(matchError(SwishError.serverError(code: expectedCode, data: performer.data)))
expect { try result?.get() }.toEventually(throwError(SwishError.serverError(code: expectedCode, data: performer.data)))
}
}

Expand All @@ -182,13 +183,13 @@ class APIClientSpec: QuickSpec {
)

let client = APIClient(requestPerformer: performer)
var error: SwishError?

var result: Result<String, SwishError>?
client.perform(request) {
error = $0.error
result = $0
}

expect(error).toEventually(matchError(SwishError.serverError(code: expectedCode, data: performer.data)))
expect { try result?.get() }.toEventually(throwError(SwishError.serverError(code: expectedCode, data: performer.data)))
}
}

Expand Down
12 changes: 7 additions & 5 deletions Tests/Tests/NetworkRequestPerformerSpec.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Swish
import Quick
import Nimble
import Result

func exampleRequest() -> URLRequest {
return URLRequest(url: URL(string: "https://example.com")!)
Expand Down Expand Up @@ -33,13 +32,14 @@ class RequestPerformerSpec: QuickSpec {
context("when the request didn't produce an error") {
it("returns a Result with the HTTPResponse") {
let fakeSession = FakeSession(data: fakeData(), response: fakeResponse(200))
var returnedCode: Int = 0
var returnedCode: Int?
var returnedData: Data?

let performer = NetworkRequestPerformer(session: fakeSession)
performer.perform(exampleRequest()) { result in
returnedCode = result.value!.code
returnedData = result.value!.data
let value = try? result.get()
returnedCode = value?.code
returnedData = value?.data
}

expect(returnedCode).to(equal(200))
Expand All @@ -55,7 +55,9 @@ class RequestPerformerSpec: QuickSpec {

let performer = NetworkRequestPerformer(session: fakeSession)
performer.perform(exampleRequest()) { result in
returnedError = result.error
if case .failure(let error) = result {
returnedError = error
}
}

expect(returnedError).to(matchError(SwishError.urlSessionError(error, response: nil)))
Expand Down
1 change: 0 additions & 1 deletion Tests/Tests/RequestSpec.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Swish
import Quick
import Nimble
import Result

struct User: Decodable {
let name: String
Expand Down

0 comments on commit ea24036

Please sign in to comment.