             try Person(id: nil, name: "Barbara").insert(db)
         }
         
-        let expectations = (UInt(2)...3).map { i -> XCTestExpectation in
-            let expectation = self.expectation(description: "")
-            expectation.expectedFulfillmentCount = i
-            expectation.assertForOverFulfill = false
-            return expectation
-        }
-        
+        // Expectation for later transaction
+        let expectation = self.expectation(description: "1")
+        expectation.expectedFulfillmentCount = 2    // two because subscription receives an immediate event, then a second on transaction.
+        
+        // Subscribe tp a request
         let request = Person.order(Column("name"))
         var records: [Person] = []
-        request.rx.fetchAll(in: writer)
+        request.rx
+            .fetchAll(in: writer)
             .subscribe(onNext: {
-                // events happen on the main thread
+                // events are expected to be delivered on the main thread
                 XCTAssertTrue(Thread.isMainThread)
                 records = $0
-                expectations.forEach { $0.fulfill() }
+                expectation.fulfill()
             })
             .addDisposableTo(disposeBag)
         

    override func tearDown() {
        disposeBag = nil
    }
    
    func testSelectionInfoRxSelection(writer: DatabaseWriter) throws {
        var selectionInfo1: SelectStatement.SelectionInfo! = nil
        var selectionInfo2: SelectStatement.SelectionInfo! = nil
        var selectionInfo3: SelectStatement.SelectionInfo! = nil
        
        try writer.write { db in
            try db.create(table: "table1") { t in
                t.column("id", .integer).primaryKey()

        self.writer = try writer(directoryURL.appendingPathComponent("db.sqlite").path)
    }
    
    @discardableResult
    func test(with testClosure: (Writer) throws -> ()) rethrows -> Self {
        try testClosure(writer)
        return self
    }
    
    deinit {
        self.writer = nil
        try! FileManager.default.removeItem(at: directoryURL)
    }
}
