Permalink
Browse files

Moved up to using Grails 2.2.0.RC1

Moved to using spock for tests
Added funtional test spec
Added ability to use -baseUrl so functional tests can be executed multiple times in Grails console
  • Loading branch information...
1 parent 6b71147 commit b1bbc73dd705090d60118bed5a67313558890d0e Chris Sterling committed Dec 9, 2012
View
@@ -1,6 +1,6 @@
#Grails Metadata file
-#Thu Nov 15 15:48:39 PST 2012
-app.grails.version=2.1.1
+#Sat Dec 08 13:14:32 PST 2012
+app.grails.version=2.2.0.RC1
app.name=AutoTest
-plugins.hibernate=2.1.1
-plugins.tomcat=2.1.1
+plugins.hibernate=2.1.0
+plugins.tomcat=2.1.0
View
@@ -23,6 +23,7 @@ target(default: "autotest") {
listener.args.add("-" + key + "=" + value)
}
}
+ println("listener args == ${listener.args}")
FileAlterationObserver observer = new FileAlterationObserver(baseProjectDirectory);
observer.addListener(listener)
@@ -1,6 +1,6 @@
#Grails Metadata file
#Mon Jan 30 21:07:04 CST 2012
-app.grails.version=2.1.1
+app.grails.version=2.2.0.RC1
app.name=bookstore
app.servlet.version=2.5
app.version=0.1
@@ -37,13 +37,25 @@ grails.project.dependency.resolution = {
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes eg.
// runtime 'mysql:mysql-connector-java:5.1.16'
+ test("org.spockframework:spock-grails-support:0.6-groovy-1.8") {
+ excludes 'spock-core'
+ }
+ test 'org.spockframework:spock-core:0.7-groovy-2.0'
}
plugins {
runtime ":hibernate:$grailsVersion"
runtime ":jquery:1.7.1"
runtime ":resources:1.1.5"
+ test(':spock:0.7') {
+ excludes 'spock-grails-support'
+ }
+
+ compile(":functional-spock:0.6") {
+ excludes 'spock-grails-support'
+ }
+
build ":tomcat:$grailsVersion"
}
}
@@ -0,0 +1,7 @@
+package bookstore
+
+class BookController {
+
+ def index() {}
+
+}
@@ -0,0 +1,17 @@
+package bookstore
+
+import spock.lang.Specification
+import grails.test.mixin.TestFor
+
+@TestFor(BookController)
+class BookControllerSpec extends Specification {
+
+ def "book controller index"() {
+ when:
+ controller.index()
+
+ then:
+ response.status == 200
+ }
+
+}
@@ -0,0 +1,11 @@
+package bookstore
+
+import spock.lang.Specification
+
+class SimpleIntegrationSpec extends Specification {
+
+ def "asserting true"() {
+ expect:
+ true
+ }
+}
@@ -1,8 +0,0 @@
-package bookstore
-
-class SimpleIntegrationTests {
-
- void testSomething() {
- assert true
- }
-}
@@ -0,0 +1,20 @@
+package bookstore
+
+import grails.test.mixin.*
+import spock.lang.Specification
+
+@TestFor(Book)
+class BookSpec extends Specification {
+
+ def "save a book"() {
+ given:
+ Book book = new Book()
+
+ when:
+ book.save()
+
+ then:
+ assert "nullable" == book.errors['title'].code
+ }
+
+}
@@ -1,14 +0,0 @@
-package bookstore
-
-import grails.test.mixin.*
-import org.junit.*
-
-@TestFor(Book)
-class BookTests {
-
- void testTitleIsRequired() {
- Book book = new Book()
- book.save()
- assert "nullable" == book.errors['title'].code + "1"
- }
-}

0 comments on commit b1bbc73

Please sign in to comment.