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 2026/10/16 15:56:10 UTC
(grails-core) 02/02: Adapt the merged layout and template specs to the 8.0.x behaviour
This is an automated email from the ASF dual-hosted git repository.
jdaugherty pushed a commit to branch 8.0.x
in repository https://gitbox.apache.org/repos/asf/grails-core.git
commit 28c013a1bb147d23549ade3c6578633c6cdba992
Author: James Daugherty <jd...@jdresources.net>
AuthorDate: Fri Oct 16 11:51:58 2026 -0400
Adapt the merged layout and template specs to the 8.0.x behaviour
GrailsContentBufferingResponse reports itself committed on 8.0.x so that JSP
views are included rather than forwarded under Tomcat 11, which means sendError
never reaches the target response. The 7.x feature that expected the error to
be delegated now asserts that contract instead.
TemplateRendererImplSpec no longer expects the destination path in the error
message. FileSystemInteractionImpl.projectPath tests the File for truth, and
Groovy 5 treats a File that no longer exists as false, so the path is omitted
once the renderer has deleted the partial output.
---
.../web/layout/GrailsViewBufferingResponseSpec.groovy | 14 +++++++++-----
.../commands/templates/TemplateRendererImplSpec.groovy | 4 +++-
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/grails-gsp/grails-layout/src/test/groovy/org/apache/grails/web/layout/GrailsViewBufferingResponseSpec.groovy b/grails-gsp/grails-layout/src/test/groovy/org/apache/grails/web/layout/GrailsViewBufferingResponseSpec.groovy
index 2ee1fed5a7..6620820959 100644
--- a/grails-gsp/grails-layout/src/test/groovy/org/apache/grails/web/layout/GrailsViewBufferingResponseSpec.groovy
+++ b/grails-gsp/grails-layout/src/test/groovy/org/apache/grails/web/layout/GrailsViewBufferingResponseSpec.groovy
@@ -138,11 +138,15 @@ class GrailsViewBufferingResponseSpec extends Specification {
target.errorMessage == null
}
- void 'sendError delegates status and message when the response is uncommitted'() {
- given:
+ void 'sendError is skipped because the buffering response always reports itself committed'() {
+ given: 'the response says it is committed so that JSP views are included rather than forwarded'
def target = new MockHttpServletResponse()
def response = new GrailsViewBufferingResponse(new MockHttpServletRequest(), target)
+ expect:
+ response.committed
+ !target.committed
+
when:
if (message == null) {
response.sendError(404)
@@ -151,9 +155,9 @@ class GrailsViewBufferingResponseSpec extends Specification {
}
then:
- target.status == 404
- target.errorMessage == message
- target.committed
+ target.status == 200
+ target.errorMessage == null
+ !target.committed
where:
message << [null, 'Missing']
diff --git a/grails-shell-cli/src/test/groovy/org/grails/cli/profile/commands/templates/TemplateRendererImplSpec.groovy b/grails-shell-cli/src/test/groovy/org/grails/cli/profile/commands/templates/TemplateRendererImplSpec.groovy
index 725ee53756..d82e6f4a21 100644
--- a/grails-shell-cli/src/test/groovy/org/grails/cli/profile/commands/templates/TemplateRendererImplSpec.groovy
+++ b/grails-shell-cli/src/test/groovy/org/grails/cli/profile/commands/templates/TemplateRendererImplSpec.groovy
@@ -132,7 +132,9 @@ class TemplateRendererImplSpec extends Specification {
then:
def exception = thrown(TemplateException)
- exception.message.startsWith('Error rendering template to destination result.txt:')
+ // projectPath leaves the destination out once the partial file is deleted: Groovy 5 treats a missing File as false
+ exception.message.startsWith('Error rendering template to destination')
+ exception.message.endsWith(': No such property: missing for class: groovy.lang.Binding')
exception.cause != null
!destination.exists()
0 * repository._