【发布时间】:2014-10-18 13:09:18
【问题描述】:
我用 Scope 进行了一些 specs2 测试:
"hello" should {
"return world" in new Subject {
hello.get === "world"
}
}
trait Subject extends org.specs2.specification.Scope {
val hello = new Hello
}
现在我想把它转换成接受风格:
def is = s2"""
hello.get should return 'world' $e1
"""
def e1 = new Subject {
hello.get === "world"
}
trait Subject extends org.specs2.specification.Scope {
val hello = new Hello
}
好像可以了,测试通过了,但是很快我发现不管怎么修改都没有失败:
hello.get === "invalid-world" // still passing
如何在接受风格中正确使用Scope?
【问题讨论】: