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

forwardCallsToSuper on class method #316

Open
1 task done
Zzz-Du opened this issue Nov 8, 2022 · 0 comments
Open
1 task done

forwardCallsToSuper on class method #316

Zzz-Du opened this issue Nov 8, 2022 · 0 comments
Labels
enhancement Feature request or improvement

Comments

@Zzz-Du
Copy link

Zzz-Du commented Nov 8, 2022

New Feature Request Checklist

Overview

I am wondering how to stub as a partial mock on class method, just like

let bird = type(of: mock(Bird.self))
bird.forwardCallsToSuper()

But i found the forwardCallsToSuper is only instance method in Mock extension

public extension Mock {
    @discardableResult
    func forwardCallsToSuper() -> Self {
        mockingbirdContext.proxy.addTarget(.super)
        return self
    }
}

Can i add the static method forwardCallsToSuper in Mock extension ?

public extension Mock {
    @discardableResult
    func forwardCallsToSuper() -> Self {
        mockingbirdContext.proxy.addTarget(.super)
        return self
    }

    @discardableResult
    static func forwardCallsToSuper() -> Self.Type {
        mockingbirdContext.proxy.addTarget(.super)
        return self
    }
}
@Zzz-Du Zzz-Du added the enhancement Feature request or improvement label Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request or improvement
Projects
None yet
Development

No branches or pull requests

1 participant