         // Given
         var configuration = pipeline.configuration
         configuration.isDataCacheForOriginalDataEnabled = false
-        let pipeline = ImagePipeline(configuration: configuration)
+        pipeline = ImagePipeline(configuration: configuration)
 
         // When
         pipeline.configuration.imageEncodingQueue.isSuspended = true
-        expect(pipeline).toLoadImage(with: request)
         expect(pipeline.configuration.imageEncodingQueue).toFinishWithEnqueuedOperationCount(1)
+        expect(pipeline).toLoadImage(with: request)
 
         // Then
         wait { _ in

        // Given pipeline with decompression disabled
        var configuration = pipeline.configuration
        configuration.isDecompressionEnabled = false
        let pipeline = ImagePipeline(configuration: configuration)

        // Given processed image data stored in data cache
        dataLoader.queue.isSuspended = true

    }
}

class ImagePipelineProcessedDataCachingTests: XCTestCase {
    var dataLoader: MockDataLoader!
    var dataCache: MockDataCache!
