Search code examples
scalatestingtddspecs2

How to mark a test as pendingUntilFixed with SpecWithJUnit


import org.specs2.mutable.SpecWithJUnit
import org.specs2.specification.Scope
import org.specs2.execute.Failure
class MyTest extends SpecWithJUnit {
  trait Context extends Scope
  "myClass" should {
    "work but not right now" in new Context {
       Failure("test fails")
    }
  }
}

In this Specs2 example, how do I mark the test as pending until fixed (as I would with SpecificationWithJUnit)?


Solution

  • You need to add the PendingUntilFixed trait:

    import org.specs2.mutable.SpecWithJUnit
    import org.specs2.specification.Scope
    import org.specs2.execute.{PendingUntilFixed, Failure}
    
    class TestSpec extends SpecWithJUnit with PendingUntilFixed {
      trait Context extends Scope
      "myClass" should {
        "work but not right now" in new Context {
          failure("test fails")
        }.pendingUntilFixed("for now")
      }
    }