                 expectation.fulfill()
             })
 
-        promise1.fulfill(1)
+        deferred1.fulfill(1)
         dispatch_async(dispatch_get_main_queue()) { () -> Void in
-            promise2.fulfill(2)
+            deferred2.fulfill(2)
         }
 
         self.waitForExpectationsWithTimeout(1.0, handler: nil)

        expectations.append(self.expectationWithDescription("4"))

        // Promise and callback registration
        let error   = self.generateRandomError()
        let promise = Promise<Int>()

        promise
            .caught(serialQueue, { (e: NSError) -> Void in

    func testOnRejectedNeverCalledIfAlreadyFulfilled() {
        let expectation = self.expectationWithDescription("wait")

        let deferred = Promise<Int>.deferred()

        deferred.fulfill(1)

        deferred.promise
            .caught({ (e: NSError) -> Void in
                XCTFail()
            })
