Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why tested protocols are suffixed by Spy and not Mock ? #32

Open
vince4 opened this issue Aug 14, 2020 · 0 comments
Open

Why tested protocols are suffixed by Spy and not Mock ? #32

vince4 opened this issue Aug 14, 2020 · 0 comments

Comments

@vince4
Copy link

vince4 commented Aug 14, 2020

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant