                 }
 
                 it("fails") {
-                    waitUntil { done in
-                        manager.authorize("username", password: "password") { result in
-                            expect(result.isSuccess).to(beFalse())
-                            expect(result.error?.code).to(equal(OAuthManagerErrorInvalidData))
-                            done()
-                        }
-                    }
+                    expect(result?.isSuccess).to(beFalse())
+                }
+
+                it("fails with the correct error code") {
+                    expect(result?.error?.code).to(equal(OAuthManagerErrorInvalidData))
                 }
 
                 it("does not set the access token") {
-                    waitUntil { done in
-                        manager.authorize("username", password: "password") { result in
-                            expect(manager.hasAccessToken).to(beFalse())
-                            done()
-                        }
-                    }
+                    expect(manager.hasAccessToken).to(beFalse())
                 }
             }
 
             context("with an invalid response missing a token") {
                 beforeEach {
-                    StubsManager.stubRequestsPassingTest({ request in
-                        return true
-                        }, withStubResponse: { request in
-                            return StubResponse(filename: "authorize-invalid-token.json", location: self.location, statusCode: 200, headers: ["Content-Type" : "application/json"])
-                    }); return
+                    StubsManager.stubRequestsPassingTest({ _ in true }) { request in
+                        return StubResponse(filename: "authorize-invalid-token.json", location: self.location, statusCode: 200, headers: ["Content-Type" : "application/json"])
+                    }
+
+                    waitUntil { done in
+                        manager.authorize("username", password: "password") { result = $0; done() }
+                    }
                 }
 
                 afterEach {

                }

                it("fails") {
                    waitUntil { done in
                        manager.authorize("username", password: "password") { result in
                            expect(result.isSuccess).to(beFalse())
                            expect(result.error?.code).to(equal(OAuthManagerErrorInvalidData))
                            done()
                        }
                    }
                }

                it("does not set the access token") {
                    waitUntil { done in
                        manager.authorize("username", password: "password") { result in
                            expect(manager.hasAccessToken).to(beFalse())
                            done()
                        }
                    }
                }
            }

            context("with an invalid response missing a type") {
                beforeEach {
                    StubsManager.stubRequestsPassingTest({ request in
                        return true
                        }, withStubResponse: { request in
                            return StubResponse(filename: "authorize-invalid-type.json", location: self.location, statusCode: 200, headers: ["Content-Type" : "application/json"])
                    }); return
                }

                afterEach {

                }

                it("succeeds") {
                    expect(result?.isSuccess).to(beTrue())
                }

                it("sets the access token") {
                    expect(manager.hasAccessToken).to(beTrue())
                }
            }

            context("with an invalid response") {
                beforeEach {
                    StubsManager.stubRequestsPassingTest({ _ in true }) { request in
                        return StubResponse(filename: "authorize-invalid.json", location: self.location, statusCode: 200, headers: ["Content-Type" : "application/json"])
                    }

                    waitUntil { done in
                        manager.authorize("username", password: "password") { result = $0; done() }
                    }
                }

                afterEach {
