Skip to content

Instantly share code, notes, and snippets.

@seratch
Created January 11, 2016 09:03
Show Gist options
  • Save seratch/8a96ca87e0773cd5bab0 to your computer and use it in GitHub Desktop.
Save seratch/8a96ca87e0773cd5bab0 to your computer and use it in GitHub Desktop.
./gradlew test for Scala projects
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.github.maiflai:gradle-scalatest:0.11"
}
}
apply plugin: 'scala'
apply plugin: "com.github.maiflai.scalatest"
ext {
scalaMajorVersion = '2.11'
scalaVersion = "${scalaMajorVersion}.7"
}
repositories {
mavenCentral()
}
dependencies {
compile "org.scala-lang:scala-library:${scalaVersion}"
testCompile "junit:junit:4.12"
testCompile "org.scalatest:scalatest_${scalaMajorVersion}:2.2.6"
testRuntime "org.pegdown:pegdown:1.1.0"
}
package foo
object Sample {
def sayHelloTo(name: String): String = s"Hello, $name!"
}
package foo
import org.scalatest._
//import org.junit.runner.RunWith
//import org.scalatest.junit.JUnitRunner
//@RunWith(classOf[JUnitRunner])
class SampleSpec extends WordSpec with Matchers {
"Sample" should {
"say hello to Martin" in {
Sample.sayHelloTo("Martin") should equal("Hello, Martin!")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment