Skip to content

Commit

Permalink
Updated README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
kshired committed Nov 5, 2023
1 parent f13cc57 commit d6c5e5f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1157,15 +1157,15 @@ every { quit(1) } throws Exception("this is a test")

### Scoped mocks

A Scoped mock is a mock that automatically unmocks itself after the code block passed as a parameter has been executed
A Scoped mock is a mock that automatically unmocks itself after the code block passed as a parameter has been executed.
You can use the `mockkObject`, `mockkStatic` and `mockkConstructor` functions.

```kotlin
object ObjBeingMocked {
fun add(a: Int, b: Int) = a + b
}

// Should be "ObjBeingMocked will be unmocked after this scope"
// ObjBeingMocked will be unmocked after this scope
mockkObject(ObjBeingMocked) {
assertEquals(3, ObjBeingMocked.add(1, 2))
every { ObjBeingMocked.add(1, 2) } returns 55
Expand Down

0 comments on commit d6c5e5f

Please sign in to comment.