1
有時我們需要在測試用例中混合使用某些特徵。然而下面不工作:在規範中創建夾具2
"abc" should {
"def" in new TraitA with TraitAB {
// ...
}
}
要使其工作,我們執行以下操作:
trait Fixture extends Before {
def before =()
}
"abc" should {
"def" in new Fixture with TraitA with TraitAB {
// ...
}
}
這種感覺有點哈克。有沒有更好的方法來做到這一點?