Upgrade Maven project to Spock 2.0-M3, ... (#35)
* Sync Spock dependency versions * Now that Spock no longer depends on 'groovy-all', for the database test it was necessary to add 'groovy-sql'. * Make feature method names friendlier in unrolled DatabaseDrivenSpec * Make IncludeExcludeExtensionSpec print messages This way the user can verify visually that in-/excludes actually work as expected. * Upgrade Groovy 2.5.12 -> 2.5.13 * Slightly adjust README.adoc Change passive style "all feedback is appreciated" to active style "we appreciate all feedback".
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
|
||||
import spock.lang.*
|
||||
|
||||
@Unroll
|
||||
class DataDrivenSpec extends Specification {
|
||||
def "maximum of two numbers"() {
|
||||
expect:
|
||||
@@ -55,4 +54,4 @@ class DataDrivenSpec extends Specification {
|
||||
name == "Fred" ? "Male" : "Female"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,18 +20,18 @@ import spock.lang.Specification
|
||||
|
||||
class DatabaseDrivenSpec extends Specification {
|
||||
@Shared sql = Sql.newInstance("jdbc:h2:mem:", "org.h2.Driver")
|
||||
|
||||
|
||||
// insert data (usually the database would already contain the data)
|
||||
def setupSpec() {
|
||||
sql.execute("create table maxdata (id int primary key, a int, b int, c int)")
|
||||
sql.execute("insert into maxdata values (1, 3, 7, 7), (2, 5, 4, 5), (3, 9, 9, 9)")
|
||||
sql.execute("insert into maxdata values (1, 3, 7, 7), (2, 5, 4, 5), (3, 9, 9, 9), (4, 2, -3, 2)")
|
||||
}
|
||||
|
||||
def "maximum of two numbers"() {
|
||||
def "Maximum of #a and #b is #c"() {
|
||||
expect:
|
||||
Math.max(a, b) == c
|
||||
|
||||
where:
|
||||
[a, b, c] << sql.rows("select a, b, c from maxdata")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,15 +49,18 @@ import spock.lang.Specification
|
||||
class IncludeExcludeExtensionSpec extends Specification {
|
||||
@Fast
|
||||
def "a fast method"() {
|
||||
println "fast"
|
||||
expect: true
|
||||
}
|
||||
|
||||
@Slow
|
||||
def "a slow method"() {
|
||||
println "slow"
|
||||
expect: true
|
||||
}
|
||||
|
||||
def "a neither fast nor slow method"() {
|
||||
println "neither fast nor slow"
|
||||
expect: true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user