Specs2: Ignore specification with a message?

rlegendi picture rlegendi · Jun 8, 2012 · Viewed 8.5k times · Source

I need to put one of my test cases into a "pending" state.

I would like to assing some sort of message to it that can be displayed on the output when running the test, something like JUnit with @Ignore("Pending: issue #1234 needs to be fixed").

Is there an equivalent for that with Specs2?

class MySpec extends mutable.Specification {
  args(skipAll = true) // Can I include a message here in the output somehow?

  "cool MyClass feature" should {
    "which is broken unfortunately" in {
      failure
    }
  }
}

Thanks in advance!

Answer

Don Roby picture Don Roby · Jun 8, 2012

For an individual example, I believe you can use:

class MySpec extends mutable.Specification {

  "cool MyClass feature" should {
    "which is broken unfortunately" in {
      failure
    }.pendingUntilFixed("message about the issue")
  }

}

I don't know if there's a way to extend this to mark all the examples in a spec as pending with the same message, as you seem to be hoping.