OK, so I’ve have a happy afternoon refactoring. M...
# minutest
d
OK, so I’ve have a happy afternoon refactoring. Most lambdas now take the fixture as both the receiver parameter. So when the subject is the fixture you can write:
Copy code
// define a test with a test block
test2("addition") {
    // inside tests, the fixture is `it`
    it.add(2)
    assertEquals(2, it.currentValue)
}

// each new test gets its own new fixture
test2("subtraction") { calculator ->
    subtract(2)
    assertEquals(-2, calculator.currentValue)
}
and when it is a set of things you can write
Copy code
context("key turned") {
    beforeEach {
        controlPanel.turnKey()
    }
    test2("light is on") {
        assertTrue(controlPanel.warningLightOn)
    }
    test2("launches when pressing button") {
        controlPanel.pressButton()
        assertFalse(beeped)
        assertTrue(launched)
    }
}