You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please answer the following questions for yourself before submitting an issue.
I am running the latest version
I checked the documentation and found no answer
I checked to make sure that this issue has not already been filed
Expected Behavior
I've encountered a scenario where I needed more than one mock of the same type but with a subset of different stubbings. Initializing each mock from scratch leads to duplication, which can only be avoided writing a custom function.
I'd like to have a copy factory function so I could write:
val first = mockk<Car> {
// base stubbings
every { drive(Direction.NORTH) } returns Outcome.OK
every { door(DoorType.FRONT_LEFT).windowState() } returns WindowState.UP
}
val second = mockk(first) {
// redefine a subset of stubbings
every { drive(Direction.SOUTH) } returns Outcome.ERROR
}
second will be a new mock instance having all the configuration copied over, and its stubbings don't affect first.
Current Behavior
The library currently doesn't support this feature.
The text was updated successfully, but these errors were encountered:
Prerequisites
Please answer the following questions for yourself before submitting an issue.
Expected Behavior
I've encountered a scenario where I needed more than one mock of the same type but with a subset of different stubbings. Initializing each mock from scratch leads to duplication, which can only be avoided writing a custom function.
I'd like to have a copy factory function so I could write:
second
will be a new mock instance having all the configuration copied over, and its stubbings don't affectfirst
.Current Behavior
The library currently doesn't support this feature.
The text was updated successfully, but these errors were encountered: