inst/examples/comments/tests/testthat/steps/steps.R

when("the Maker starts a game", function(context) {
  context$game <- "game"
})

then("the Maker waits for a Breaker to join", function(context) {
  expect_equal(context$game, "game")
})

given("the Maker has started a game with the word {string}", function(x, context) {
  context$word <- x
})

when("the Breaker joins the Maker's game", function(context) {

})

then("the Breaker must guess a word with {int} characters", function(n, context) {
  expect_equal(nchar(context$word), n)
})

Try the cucumber package in your browser

Any scripts or data that you put into this service are public.

cucumber documentation built on June 30, 2024, 1:07 a.m.