wvlet / airframe

Essential Building Blocks for Scala
https://wvlet.org/airframe
Apache License 2.0
631 stars 65 forks source link

airspec: Support injection at before/beforeAll #784

Closed xerial closed 4 years ago

xerial commented 4 years ago
class A extends AirSpec {
  override protected def design = newDesign.bind[X].toInstance(x)

  private var x:X;
  protected def beforeAll(x:X) { this.x = x }

  def test = {  
     // use x 
  }
  def test2 = {
     // use x
  }
}
xerial commented 4 years ago

@shimamoto Does this work for your use cases?

xerial commented 4 years ago

I'll close this ticket in favor of the new test(..., design = ...) syntax #876