You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by jd...@apache.org on 2025/06/30 02:22:30 UTC

(grails-core) 01/01: test: #14193 add test case for changes after forward

This is an automated email from the ASF dual-hosted git repository.

jdaugherty pushed a commit to branch issue14193
in repository https://gitbox.apache.org/repos/asf/grails-core.git

commit 4189258a78f5d09219d3d6528a305633d49c50ff
Author: James Daugherty <jd...@jdresources.net>
AuthorDate: Sun Jun 29 22:21:51 2025 -0400

    test: #14193 add test case for changes after forward
---
 grails-test-examples/app1/build.gradle                    |  4 ++++
 .../functionaltests/ForwardingController.groovy           | 15 +++++++++++++++
 .../app1/grails-app/views/forwarding/forwardedView.gsp    |  8 ++++++++
 .../groovy/functionaltests/ForwardingSpec.groovy          |  8 ++++++++
 4 files changed, 35 insertions(+)

diff --git a/grails-test-examples/app1/build.gradle b/grails-test-examples/app1/build.gradle
index fef740daf9..4d2746c70f 100644
--- a/grails-test-examples/app1/build.gradle
+++ b/grails-test-examples/app1/build.gradle
@@ -78,6 +78,10 @@ test {
 //compileGroovy.groovyOptions.fork = true
 //compileGroovy.groovyOptions.forkOptions.jvmArgs = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005']
 
+//bootRun {
+//    jvmArgs("-Xdebug", "-Xnoagent", "-Djava.compiler=NONE", "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005")
+//}
+
 apply {
     from rootProject.layout.projectDirectory.file('gradle/functional-test-config.gradle')
     from rootProject.layout.projectDirectory.file('gradle/java-config.gradle')
diff --git a/grails-test-examples/app1/grails-app/controllers/functionaltests/ForwardingController.groovy b/grails-test-examples/app1/grails-app/controllers/functionaltests/ForwardingController.groovy
index a102938f60..eba12783d4 100644
--- a/grails-test-examples/app1/grails-app/controllers/functionaltests/ForwardingController.groovy
+++ b/grails-test-examples/app1/grails-app/controllers/functionaltests/ForwardingController.groovy
@@ -19,6 +19,8 @@
 
 package functionaltests
 
+import org.springframework.http.HttpStatus
+
 class ForwardingController {
 
     def one() {
@@ -41,6 +43,19 @@ class ForwardingController {
         forward action: 'list'
     }
 
+    def forwardWithRender(String anArgument) {
+        if(!anArgument) {
+            forward action: 'renderedView'
+            return
+        }
+
+        render text: 'did not forward', status: HttpStatus.OK
+    }
+
+    def renderedView() {
+        render view: 'forwardedView'
+    }
+
     def list() {
         [people: ['Jeff', 'Jake', 'Zack', 'Betsy']]
     }
diff --git a/grails-test-examples/app1/grails-app/views/forwarding/forwardedView.gsp b/grails-test-examples/app1/grails-app/views/forwarding/forwardedView.gsp
new file mode 100644
index 0000000000..764342fc50
--- /dev/null
+++ b/grails-test-examples/app1/grails-app/views/forwarding/forwardedView.gsp
@@ -0,0 +1,8 @@
+<html>
+<head>
+    <meta name="layout" content="main" />
+</head>
+<body>
+<p id="message">Hello from a forwarded view</p>
+</body>
+</html>
diff --git a/grails-test-examples/app1/src/integration-test/groovy/functionaltests/ForwardingSpec.groovy b/grails-test-examples/app1/src/integration-test/groovy/functionaltests/ForwardingSpec.groovy
index 3425de1a15..03cb8514dd 100644
--- a/grails-test-examples/app1/src/integration-test/groovy/functionaltests/ForwardingSpec.groovy
+++ b/grails-test-examples/app1/src/integration-test/groovy/functionaltests/ForwardingSpec.groovy
@@ -96,4 +96,12 @@ class ForwardingSpec extends ContainerGebSpec {
         then: 'the flash message has been cleared'
         $('div', id: 'message').text() == 'flash.message is []'
     }
+
+    void "forwarding to a view"() {
+        when: "A forward is issued to a view"
+        go '/forwarding/forwardWithRender'
+
+        then: "The view is rendered correctly"
+        $('p', id: 'message').text() == 'Hello from a forwarded view'
+    }
 }