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".
main
Alexander Kriegisch 5 years ago committed by GitHub
parent f1491efa0e
commit 744bf74767
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -76,7 +76,7 @@ The Jars will be copied to `build/output/lib`. The comments in `build.gradle` ex
* http://groovy-lang.org/[Groovy homepage] * http://groovy-lang.org/[Groovy homepage]
* http://maven.apache.org[Maven homepage] * http://maven.apache.org[Maven homepage]
If you have any comments or questions, please direct them to the Spock discussion group. All feedback is appreciated! If you have any comments or questions, please direct them to the Spock discussion group. We appreciate all feedback!
Happy spec'ing! Happy spec'ing!

@ -15,18 +15,19 @@ repositories {
dependencies { dependencies {
// mandatory dependencies for using Spock // mandatory dependencies for using Spock
compile "org.codehaus.groovy:groovy-all:2.5.8" compile "org.codehaus.groovy:groovy:2.5.13"
testCompile platform("org.spockframework:spock-bom:2.0-M1-groovy-2.5") testCompile platform("org.spockframework:spock-bom:2.0-M3-groovy-2.5")
testCompile "org.spockframework:spock-core" testCompile "org.spockframework:spock-core"
testCompile "org.spockframework:spock-junit4" // you can remove this if your code does not rely on old JUnit 4 rules testCompile "org.spockframework:spock-junit4" // you can remove this if your code does not rely on old JUnit 4 rules
// optional dependencies for using Spock // optional dependencies for using Spock
testCompile "org.hamcrest:hamcrest-core:1.3" // only necessary if Hamcrest matchers are used testCompile "org.hamcrest:hamcrest-core:2.2" // only necessary if Hamcrest matchers are used
testRuntime "net.bytebuddy:byte-buddy:1.9.3" // allows mocking of classes (in addition to interfaces) testRuntime "net.bytebuddy:byte-buddy:1.10.10" // allows mocking of classes (in addition to interfaces)
testRuntime "org.objenesis:objenesis:2.6" // allows mocking of classes without default constructor (together with CGLIB) testRuntime "org.objenesis:objenesis:3.1" // allows mocking of classes without default constructor (together with ByteBuddy or CGLIB)
// dependencies used by examples in this project // dependencies used by examples in this project
testRuntime "com.h2database:h2:1.4.197" testRuntime "com.h2database:h2:1.4.197"
compile "org.codehaus.groovy:groovy-sql:2.5.13"
} }
// the remaining configuration is specific to this project, and is not required for using Spock // the remaining configuration is specific to this project, and is not required for using Spock

@ -11,6 +11,7 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<groovy.version>2.5.13</groovy.version>
</properties> </properties>
<build> <build>
@ -60,7 +61,7 @@
<dependency> <dependency>
<groupId>org.spockframework</groupId> <groupId>org.spockframework</groupId>
<artifactId>spock-bom</artifactId> <artifactId>spock-bom</artifactId>
<version>2.0-M1-groovy-2.5</version> <version>2.0-M3-groovy-2.5</version>
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
@ -83,24 +84,24 @@
<dependency> <!-- use a specific Groovy version rather than the one specified by spock-core --> <dependency> <!-- use a specific Groovy version rather than the one specified by spock-core -->
<groupId>org.codehaus.groovy</groupId> <groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId> <artifactId>groovy</artifactId>
<version>2.5.8</version> <version>${groovy.version}</version>
</dependency> </dependency>
<dependency> <!-- enables mocking of classes (in addition to interfaces) --> <dependency> <!-- enables mocking of classes (in addition to interfaces) -->
<groupId>net.bytebuddy</groupId> <groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId> <artifactId>byte-buddy</artifactId>
<version>1.9.3</version> <version>1.10.10</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <!-- enables mocking of classes without default constructor (together with CGLIB) --> <dependency> <!-- enables mocking of classes without default constructor (together with ByteBuddy or CGLIB) -->
<groupId>org.objenesis</groupId> <groupId>org.objenesis</groupId>
<artifactId>objenesis</artifactId> <artifactId>objenesis</artifactId>
<version>2.6</version> <version>3.1</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <!-- only required if Hamcrest matchers are used --> <dependency> <!-- only required if Hamcrest matchers are used -->
<groupId>org.hamcrest</groupId> <groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId> <artifactId>hamcrest-core</artifactId>
<version>1.3</version> <version>2.2</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!-- Dependencies used by examples in this project (not required for using Spock) --> <!-- Dependencies used by examples in this project (not required for using Spock) -->
@ -109,6 +110,11 @@
<artifactId>h2</artifactId> <artifactId>h2</artifactId>
<version>1.4.197</version> <version>1.4.197</version>
</dependency> </dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-sql</artifactId>
<version>${groovy.version}</version>
</dependency>
</dependencies> </dependencies>
<repositories> <repositories>

@ -16,7 +16,6 @@
import spock.lang.* import spock.lang.*
@Unroll
class DataDrivenSpec extends Specification { class DataDrivenSpec extends Specification {
def "maximum of two numbers"() { def "maximum of two numbers"() {
expect: expect:

@ -24,10 +24,10 @@ class DatabaseDrivenSpec extends Specification {
// insert data (usually the database would already contain the data) // insert data (usually the database would already contain the data)
def setupSpec() { def setupSpec() {
sql.execute("create table maxdata (id int primary key, a int, b int, c int)") 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: expect:
Math.max(a, b) == c Math.max(a, b) == c

@ -49,15 +49,18 @@ import spock.lang.Specification
class IncludeExcludeExtensionSpec extends Specification { class IncludeExcludeExtensionSpec extends Specification {
@Fast @Fast
def "a fast method"() { def "a fast method"() {
println "fast"
expect: true expect: true
} }
@Slow @Slow
def "a slow method"() { def "a slow method"() {
println "slow"
expect: true expect: true
} }
def "a neither fast nor slow method"() { def "a neither fast nor slow method"() {
println "neither fast nor slow"
expect: true expect: true
} }
} }

Loading…
Cancel
Save