Skip to content

Commit

Permalink
📝 (spek): Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
xgouchet committed Aug 24, 2020
1 parent ec314f5 commit 70c479e
Showing 1 changed file with 34 additions and 4 deletions.
38 changes: 34 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ You can instantiate a `ForgeRule` instance, which extends the `Forge` class,
add factories to it, and then annotate fields on your test class with `@Forgery`.

```kotlin
class FoonTest {
class FooTest {

@Rule
@JvmField
Expand All @@ -76,7 +76,7 @@ test methods.
```kotlin
@ExtendWith(ForgeExtension::class)
@ForgeConfiguration(KotlinAnnotationTest.Configurator::class)
open class FooTest {
internal class FooTest {

@Forgery
internal lateinit var fakeBar: Bar
Expand All @@ -91,17 +91,47 @@ open class FooTest {
}
```



### `spek` forgeries

You can create a custom Forge instance with `spekForge` to be able to
add reproducibility to Spek tests.

```kotlin
class CalculatorSpek : Spek({

val forge = spekForge(
seeds = mapOf(
"CalculatorSpek/A calculator/addition/returns the sum of its arguments" to 0x1337L
)
)

describe("A calculator") {
val calculator by memoized { Calculator() }

describe("addition") {
it("returns the sum of its arguments") {
val a = forge.anInt()
val b = forge.anInt()
assertEquals(calculator.add(a, b), a + b)
}
}
}
})
```

## Documentation

The full documentation will be comming shortly
The full documentation will be coming shortly

## Contributing

Contribution is fully welcome. Before submitting a Pull Request, please verify you comply with the following checklist :

- [x] All public classes, methods and fields must be documented
- [x] All code must be unit tested (duh…)
- [x] All code should be useable with and without the Android SDK, from Java and Kotlin
- [x] All code should be usable with and without the Android SDK, from Java and Kotlin

## Release History

Expand Down

0 comments on commit 70c479e

Please sign in to comment.