Using Cuckoo 1.4.1, I get the error
Global function 'stub(_:block:)' requires that 'DeepFileManager' conform to 'Mock'
I don't know how to proceed, because the instance passed to the stub function was created from the class in GeneratedMocks.swift. The reference to DeepFileManager is the class that is mocked.
So it's a mystery to me why Swift 4 would complain about the conformance of the superclass of the instance I've passed to it. Can you lead me out of this conundrum?
Here's the code for the test:
class RecordingTests: QuickSpec {
override func spec() {
let FAKE_ID = "String";
let mockFileManager: MockDeepFileManager = MockDeepFileManager()
let cut = Recording(id: FAKE_ID, date: nil, status: nil, device: nil, deviceId: nil, deviceName: nil, fileManager: mockFileManager)
describe("A recording") {
context("when it's not on disk") {
it("responds that filePresent is false") {
stub(mockFileManager) {stub in
when(stub.fileExists(audioId: FAKE_ID)).then()
}
expect(cut.filePresent()).to(equal(false))
verify(mockFileManager).fileExists(audioId: "Matchable")
}
}
}
}
And here's the declaration of MockDeepFileManager from GeneratedMocks.swift:
class MockDeepFileManager: DeepFileManager, Cuckoo.ClassMock {