Skip to content

Instantly share code, notes, and snippets.

@etorreborre
Created January 20, 2014 21:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save etorreborre/8529040 to your computer and use it in GitHub Desktop.
Save etorreborre/8529040 to your computer and use it in GitHub Desktop.
class TestSpec extends Specification {
"example" in new Context {
"example".pp
ok
}
trait Context extends Around {
def before = "before".pp
def after = {
"after".pp
barReader
}
var barReader: BarReader = _
lazy val bar = barReader.someBar
def around[T : AsResult](t: =>T) = {
try {
before
AsResult.effectively(t)
} finally after
}
}
trait BarReader {
def someBar: Bar
}
trait Bar
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment