We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c565534 commit e5bc6fbCopy full SHA for e5bc6fb
src/main/kotlin/dsl/FsmSpec.kt
@@ -17,4 +17,9 @@ class FsmSpec(
17
state = State(initialState)
18
)
19
}
20
+
21
+ operator fun invoke(block: FsmSpec.() -> Unit): Fsm {
22
+ block()
23
+ return build()
24
+ }
25
src/test/kotlin/dsl/FsmTest.kt
@@ -18,4 +18,19 @@ class FsmTest : BehaviorSpec({
+ given("2222") {
+ `when`("I sit on it") {
+ val fsmSpec = FsmSpec(initialState = "locked")
+ val fsm = fsmSpec {
26
+ add { this on "coin" from "locked" into "unlocked" }
27
+ add { this on "pass" from "unlocked" into "locked" }
28
29
30
+ then("I should be able to fly") {
31
+ fsm.initial shouldBe State("locked")
32
+ fsm.transitions shouldHave haveSize(2)
33
34
35
36
})
0 commit comments