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

[2.0] Configure should be generic #97

Closed
DanielJette opened this issue Sep 30, 2022 · 0 comments · Fixed by #107
Closed

[2.0] Configure should be generic #97

DanielJette opened this issue Sep 30, 2022 · 0 comments · Fixed by #107
Labels
Architecture Extension Relates to one of the extension libraries Feedback Library Relates to the Testify Kotlin library: ScreenshotRule, ScreenshotInstrumentation, etc. Testify 2.0

Comments

@DanielJette
Copy link
Contributor

The new configure method should return a generic.

Configure always returns a ScreenshotTest<T> but this means that subclasses of the Rule (like ComposableScreenshotRule) must be invoked prior to configure. It breaks the logical flow of the test where it's common to want to configure first, then set your composables. The configure method should be something more like:

fun <TRule : ScreenshotRule<T>> configure(configureRule: TestifyConfiguration.() -> Unit): TRule {
    configureRule.invoke(configuration)
    return this as TRule
}
@DanielJette DanielJette added Feedback Library Relates to the Testify Kotlin library: ScreenshotRule, ScreenshotInstrumentation, etc. Testify 2.0 Extension Relates to one of the extension libraries Architecture labels Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Architecture Extension Relates to one of the extension libraries Feedback Library Relates to the Testify Kotlin library: ScreenshotRule, ScreenshotInstrumentation, etc. Testify 2.0
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant