Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add convenience traits for various Suites. [fixes #21]
- Loading branch information
1 parent
1d8b7ab
commit 4240b58
Showing
6 changed files
with
87 additions
and
25 deletions.
There are no files selected for viewing
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
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
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
5 changes: 0 additions & 5 deletions
5
scalatest/src/main/scala/org/scalatra/test/scalatest/ScalatraFunSuite.scala
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
scalatest/src/main/scala/org/scalatra/test/scalatest/ScalatraSuite.scala
This file was deleted.
Oops, something went wrong.
67 changes: 67 additions & 0 deletions
67
scalatest/src/main/scala/org/scalatra/test/scalatest/scalatest.scala
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package org.scalatra.test | ||
package scalatest | ||
|
||
import org.junit.runner.RunWith | ||
import org.eclipse.jetty.testing.ServletTester | ||
import org.scalatest._ | ||
import org.scalatest.junit.{JUnitSuite, JUnit3Suite, JUnitRunner} | ||
import org.scalatest.testng.TestNGSuite | ||
|
||
@RunWith(classOf[JUnitRunner]) | ||
/** | ||
* Provides Scalatra test support to ScalaTest suites. The servlet tester | ||
* is started before the first test in the suite and stopped after the last. | ||
*/ | ||
trait ScalatraSuite extends ScalatraTests with BeforeAndAfterAll { | ||
this: Suite => | ||
|
||
lazy val tester = new ServletTester | ||
|
||
override protected def beforeAll(): Unit = start() | ||
override protected def afterAll(): Unit = stop() | ||
} | ||
|
||
/** | ||
* Convenience trait to add Scalatra test support to JUnit3Suite. | ||
*/ | ||
trait ScalatraJUnit3Suite extends JUnit3Suite with ScalatraSuite | ||
|
||
/** | ||
* Convenience trait to add Scalatra test support to JUnitSuite. | ||
*/ | ||
trait ScalatraJUnitSuite extends JUnitSuite with ScalatraSuite | ||
|
||
/** | ||
* Convenience trait to add Scalatra test support to TestNGSuite. | ||
*/ | ||
trait ScalatraTestNGSuite extends TestNGSuite with ScalatraSuite | ||
|
||
/** | ||
* Convenience trait to add Scalatra test support to FeatureSpec. | ||
*/ | ||
trait ScalatraFeatureSpec extends FeatureSpec with ScalatraSuite | ||
|
||
/** | ||
* Convenience trait to add Scalatra test support to Spec. | ||
*/ | ||
trait ScalatraSpec extends Spec with ScalatraSuite | ||
|
||
/** | ||
* Convenience trait to add Scalatra test support to FlatSpec. | ||
*/ | ||
trait ScalatraFlatSpec extends FlatSpec with ScalatraSuite | ||
|
||
/** | ||
* Convenience trait to add Scalatra test support to FreeSpec. | ||
*/ | ||
trait ScalatraFreeSpec extends FreeSpec with ScalatraSuite | ||
|
||
/** | ||
* Convenience trait to add Scalatra test support to WordSpec. | ||
*/ | ||
trait ScalatraWordSpec extends WordSpec with ScalatraSuite | ||
|
||
/** | ||
* Convenience trait to add Scalatra test support to FunSuite. | ||
*/ | ||
trait ScalatraFunSuite extends FunSuite with ScalatraSuite |