Advertisement
Guest User

Untitled

a guest
Jun 11th, 2014
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.77 KB | None | 0 0
  1. Class:
  2.  
  3. /** (Playframework 2.2 extension for use with Specs2)
  4.  * Used to run specs within the context of a running application.
  5.  *
  6.  * @param app The fake application
  7.  */
  8. abstract class WithApplication(val app: FakeApplication = FakeApplication()) extends Around with Scope {
  9.   implicit def implicitApp = app
  10.   override def around[T: AsResult](t: => T): Result = {
  11.     Helpers.running(app)(AsResult.effectively(t))
  12.   }
  13. }
  14.  
  15. Use:
  16.  
  17. "tests something" in new WithApplication() {
  18.   //the test here
  19. }
  20.  
  21. Question:
  22.  
  23. Why isn't the test code between the braces executed immediately on instantiation?  (It seems like it would be part of the constructor or something.)   How is it assigned to a variable and executed in around. (Or is this even the right understanding of what happens?)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement