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

Support custom .mustache templates #37

Open
remover opened this issue Jun 19, 2020 · 3 comments
Open

Support custom .mustache templates #37

remover opened this issue Jun 19, 2020 · 3 comments

Comments

@remover
Copy link

remover commented Jun 19, 2020

It would be cool if the user of the plugin could format the output from the plugin according to their wishes / standards in relation to naming in particular, i.e. the use of the term ...Spy for captured parameters or to enable the exclusion of some of the generated properties, e.g. the boolean invoked.

This would potentially make it easier for people to switch from a previous mocking tool in order to maintain consistency in their codebase.

@seanhenry
Copy link
Owner

Hi @remover

Thanks for raising this issue. This is something I've wanted to do for a while. I will try and allocate some time to add support for this soon. I'll post here with any updates.

@seanhenry
Copy link
Owner

Can you share an example custom mock with me? I need to know what attributes you'll need in your custom moustache files.

@remover
Copy link
Author

remover commented Jun 19, 2020

sure... our mocks are fairly simple:

protocol TestProtocol {
    func doSomething(withValue value: Int) -> Bool
}

public final class MockTestProtocol: TestProtocol {

    // MARK: - Init

    public init(
    ) { 
    }

    // MARK: - doSomething

    public var doSomethingWithValueCallCount = 0
    public var doSomethingWithValueSpy: Int?
    public var doSomethingWithValueStub: Bool? = <# Stub #>

    public func doSomething(withValue value: Int) -> Bool {
        doSomethingWithValueCallCount += 1
        doSomethingWithValueSpy = value
        return doSomethingWithValueStub
    }
}

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

2 participants