Created
June 23, 2011 15:47
-
-
Save lamdor/1042813 to your computer and use it in GitHub Desktop.
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
package examples | |
import org.specs2.mutable.Specification | |
import org.specs2.specification.{Before, Scope} | |
class BeforeWeirdnessSpec extends Specification { | |
"Before" should { | |
"execute before the example with a object" in context1 { | |
1 must_== 1 | |
} | |
"execute before the example with a trait" in new context2 { | |
1 must_== 1 | |
} | |
} | |
object context1 extends Before { | |
def before = { | |
println("BEFORE (in context1)...") | |
() | |
} | |
} | |
trait context2 extends Scope with Before { | |
def before = { | |
println("BEFORE (in context2)...") | |
() | |
} | |
} | |
} | |
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
[info] == examples.BeforeWeirdnessSpec == | |
BEFORE (in context1)... | |
[info] Before should | |
[info] + execute before the example with a object | |
[info] + execute before the example with a trait | |
[info] | |
[info] | |
[info] Total for specification BeforeWeirdnessSpec | |
[info] Finished in 177 ms | |
[info] 2 examples, 0 failure, 0 error | |
[info] | |
[info] == examples.BeforeWeirdnessSpec == |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment