     
     func testImmediateAndDelayed() {
         let future = Future<Bool>()
-        let expectation_immediate = expectationWithDescription("Immediate future success")
-        let expectation_delayed = expectationWithDescription("Delayed future success")
-        future.onSuccess {value in
-            XCTAssert(false, "onSuccess called")
-        }
-        future.onFailure {error in
-            XCTAssertEqual(error.code, 100, "\(error)")
-            expectation_immediate.fulfill()
-        }
-        future.failure(self.error)
-        future.onFailure {error in
-            XCTAssertEqual(error.code, 100, "\(error)")
-            expectation_delayed.fulfill()
+        let expectationImmediate = expectationWithDescription("Immediate future success")
+        let expectationDelayed = expectationWithDescription("Delayed future success")
+        future.onSuccess {value in
+            XCTAssert(false, "onSuccess called")
+        }
+        future.onFailure {error in
+            XCTAssertEqual(error.code, 100, "\(error)")
+            expectationImmediate.fulfill()
+        }
+        future.failure(TestFailure.error)
+        future.onFailure {error in
+            XCTAssertEqual(error.code, 100, "\(error)")
+            expectationDelayed.fulfill()
         }
         waitForExpectationsWithTimeout(2) {error in
             XCTAssertNil(error, "\(error)")


    func testImmediateAndDelayed() {
        let future = Future<Bool>()
        let expectation_immediate = expectationWithDescription("Immediate future success")
        let expectation_delayed = expectationWithDescription("Delayed future success")
        future.onSuccess {value in
            XCTAssertTrue(value, "Invalid value")
            expectation_immediate.fulfill()
        }
        future.onFailure {error in
            XCTAssert(false, "onFailure called")

import XCTest
import SimpleFutures

struct TestFailure {
    static let error = NSError(domain:"SimpleFutures", code:100, userInfo:[NSLocalizedDescriptionKey:"Testing"])
}

class FuturesSuccessTests: XCTestCase {
    
    override func setUp() {
