Skip to content

Instantly share code, notes, and snippets.

@bvenners
Created December 14, 2013 21:28
Show Gist options
  • Select an option

  • Save bvenners/7965105 to your computer and use it in GitHub Desktop.

Select an option

Save bvenners/7965105 to your computer and use it in GitHub Desktop.
How to override tags to tag scopes in ScalaTest 2.0
import org.scalatest._
import Matchers._
import tagobjects._
class ExampleSpec extends FreeSpec {
override lazy val tags: Map[String, Set[String]] =
super.tags.transform {
case (testName, tagsSet) if testName startsWith "scope1" => tagsSet + "Scope1"
case (testName, tagsSet) if testName startsWith "scope2" => tagsSet + "Scope2"
case (_, existingSet) => existingSet
}
"scope1" - {
"slow" taggedAs Slow in {
1 + 1 shouldEqual 2
}
"disk" taggedAs Disk in {
1 + 1 shouldEqual 2
}
}
"scope2" - {
"network" taggedAs Network in {
1 + 1 shouldEqual 2
}
"cpu" taggedAs CPU in {
1 + 1 shouldEqual 2
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment