You can mix in the Tags property and define any section that you want:
import org.specs2.mutable._ class MyClassSpec extends Specification with Tags { section("pending") "myMethod" should { "return positive values" in { MyClass.myMethod must beGreaterThan(0) } "return values less than 100" in { MyClass.myMethod must beLessThan(100) } } section("pending") }
Then you run your spec with exclude pending
>test-only *MyClassSpec* -- exclude pending
This is documented here .
You can also use an implicit context to make sure all of your examples in the should PendingUntilFixed block:
import org.specs2._ import execute._ class MyClassSpec extends mutable.Specification { "this doesn't work for now" >> { implicit val puf = pendingContext("FIXME") "ex1" in ko "ex2" in ok } "but this works ok" >> { "ex3" in ko
Update for specs2 3.x
import org.specs2._ import execute._ class TestMutableSpec extends mutable.Specification { "this doesn't work for now" >> { implicit def context[T] = pendingContext[T]("FIXME") "ex1" in ko "ex2" in ok } "but this works ok" >> { "ex3" in ko // maybe not here ;-) "ex4" in ok } def pendingContext[T](reason: String): AsResult[MatchResult[T]] = new AsResult[MatchResult[T]] { def asResult(t: =>MatchResult[T]): Result = AsResult(t).pendingUntilFixed(reason) } }
Eric
source share