Created
January 20, 2014 21:00
-
-
Save etorreborre/8529040 to your computer and use it in GitHub Desktop.
Stackoverflow question: http://stackoverflow.com/questions/21154941/specs2-after-method-runs-before-the-example/21223797?noredirect=1#comment31984520_21223797
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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