Skip to content

Instantly share code, notes, and snippets.

@kyonmm
Last active December 22, 2015 15:39
Show Gist options
  • Select an option

  • Save kyonmm/6493492 to your computer and use it in GitHub Desktop.

Select an option

Save kyonmm/6493492 to your computer and use it in GitHub Desktop.
Spockテンプレ。 curl -s get.gvmtool.net | bash でインストール。gvm install gradle.  projectディレクトリをつくって、そこにbuild.gradleをコピーして、gradle --daemon idea. open hoge.ipr. src/main/groovyとsrc/test/groovyを作成してsourceとtestとして指定する。あとは書く。 importとかの自動生成は赤線に合わせてAlt + Enterだった気がする。
apply plugin: "groovy"
apply plugin: "idea"
apply plugin: "build-announcements"
repositories{
mavenCentral()
}
dependencies{
compile "org.codehaus.groovy:groovy-all:2.1.+"
testCompile "org.spockframework:spock-core:0.7-groovy-2.0"
}
import org.spock.*
class HogeSpec extends Specification {
@Unroll
def "sample #a #b #expected "(){
given:
println "$a $b $ expected"
when:
println "$a $b $ expected"
then:
a + b == expected
where:
a | b || expected
1 | 2 || 3
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment