 
         return NSError(domain: "test.SomeError", code: code, userInfo: nil)
     }
-}
-
+
+    private func isInTestDispatchQueue() -> Bool {
+        return dispatch_get_specific(&testQueueTag) != nil
+    }
+}
+

import UIKit
import XCTest

class OnePromiseTests: XCTestCase {


        promise.fulfill(1)
        self.waitForExpectationsWithTimeout(1.0, handler: nil)
    }

    func testFinWithRejection() {
        let expectation = self.expectationWithDescription("done")

        let promise = Promise<Int>()

        promise.fin({
            expectation.fulfill()
        })

        promise.reject(self.generateRandomError())
        self.waitForExpectationsWithTimeout(1.0, handler: nil)
    }

    func testThenFin() {
        let expectation = self.expectationWithDescription("done")

        let promise = Promise<Int>()

        promise
            .then({ (_) -> Void in

            })
            .fin({
                expectation.fulfill()
            })

        promise.reject(self.generateRandomError())
        self.waitForExpectationsWithTimeout(1.0, handler: nil)
    }
}

// MARK: Helpers
