-
Notifications
You must be signed in to change notification settings - Fork 314
Open
Description
I try to understand the difference between Mock and Spy in Unit Test.
I found in CleanStore that every mock/spy is suffixed with Spy.
But in this article, it's explained that Spy are real objects whereas Mock, new test objects doing nothing :
The difference is that in mock, you are creating a complete mock or fake object while in spy, there is the real object and you just spying or stubbing specific methods of it.
An exemple of Mock in CleanStore :
class ListOrdersPresentationLogicSpy: ListOrdersPresentationLogic
{
// MARK: Method call expectations
var presentFetchedOrdersCalled = false
// MARK: Spied methods
func presentFetchedOrders(response: ListOrders.FetchOrders.Response)
{
presentFetchedOrdersCalled = true
}
}
So should you rename ListOrdersPresentationLogicSpy to ListOrdersPresentationLogicMock, or did I misunderstood something ?
Metadata
Metadata
Assignees
Labels
No labels