 
             let taskCalled = expectationWithDescription("Task was called")
             let promise = Promise<Int> { fulfill in
+                fulfill(Result { expectedResult })
+
                 taskCalled.fulfill()
-
-                fulfill(Result { expectedResult })
             }
 
             let completionCalled = expectationWithDescription("Completion was called")


        let taskCalled = expectationWithDescription("Task was called")
        let promise = Promise<Int> { fulfill in
            taskCalled.fulfill()

            XCTAssertTrue(NSThread.isMainThread(), "Expected the task to run on the main thread.")

            fulfill(Result { expectedValue })
        }

        let group = dispatch_group_create()


            let successCalled = expectationWithDescription("Success block was called")
            let promise = initialPromise.success { value in
                XCTAssertEqual(expectedValue, value, "Expected the given success value.")
                successCalled.fulfill()
            }

            let completionCalled = expectationWithDescription("Completion was called")
            promise.call { result in
                TestHelpers.expectSuccess(expectedValue, result: result, message: "Expected the given success value.")
                completionCalled.fulfill()
            }

            waitForExpectationsWithTimeout(1.0, handler: nil)
