Skip to content

Instantly share code, notes, and snippets.

@mzp
Created June 27, 2011 06:18
Show Gist options
  • Save mzp/1048386 to your computer and use it in GitHub Desktop.
Save mzp/1048386 to your computer and use it in GitHub Desktop.
unfiltered-scalatest.diff
diff --git a/scalatest/src/main/scala/jetty/Served.scala b/scalatest/src/main/scala/jetty/Served.scala
index 551f5e5..a54ad7c 100755
--- a/scalatest/src/main/scala/jetty/Served.scala
+++ b/scalatest/src/main/scala/jetty/Served.scala
@@ -1,21 +1,21 @@
package unfiltered.scalatest.jetty
import _root_.unfiltered.scalatest.Hosted
-import org.scalatest.FeatureSpec
+import org.scalatest.{FeatureSpec, BeforeAndAfterAll}
-trait Served extends FeatureSpec with Hosted {
+trait Served extends FeatureSpec with BeforeAndAfterAll with Hosted {
import unfiltered.jetty._
def setup: (Server => Server)
- lazy val server = setup(Http(port))
- override protected def withFixture(test: NoArgTest) {
- server.start();
- try {
- test() // Invoke the test function
- } finally {
- server.stop();
- server.destroy();
- }
+ lazy val server : Server = setup(Http(port))
+
+ override protected def beforeAll {
+ server.start()
+ }
+
+ override protected def afterAll {
+ server.stop()
+ server.destroy()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment