Last active
December 22, 2015 15:39
-
-
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だった気がする。
This file contains hidden or 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
| 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" | |
| } |
This file contains hidden or 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
| 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