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

Properties are not supported as DynamicCalls #51

Closed
Albert-Gao opened this Issue Mar 22, 2018 · 2 comments

Comments

2 participants
@Albert-Gao

Albert-Gao commented Mar 22, 2018

From Gitter.

I want to test some actions against a protected property. Don't know how. I create a gist with simple example: https://gist.github.com/Albert-Gao/e546a8f2ea6d6be0b766c30dab476dbe Any help here?

oleksiyp added a commit that referenced this issue Mar 22, 2018

@oleksiyp

This comment has been minimized.

Collaborator

oleksiyp commented Mar 22, 2018

@Albert-Gao version 1.7.15 is released(syncing to central repo during next half an hour). You can try it out and close the ticket if it fulfills it.

Syntax is following(added this to README):

val mock = spyk(Team(), recordPrivateCalls = true)

every { mock getProperty "speed" } returns 33
every { mock setProperty "acceleration" value less(5) } just Runs
every { mock invoke "openDoor" withArguments listOf("left", "rear") } returns "OK"

verify { mock getProperty "speed" }
verify { mock setProperty "acceleration" value less(5) }
verify { mock invoke "openDoor" withArguments listOf("left", "rear") }
@Albert-Gao

This comment has been minimized.

Albert-Gao commented Mar 23, 2018

very readable syntax
tried, works! thx

@Albert-Gao Albert-Gao closed this Mar 23, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment