Skip to content

Commit

Permalink
#10583 - bring forward test that was never merged in Grails 3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
jdaugherty committed Feb 8, 2025
1 parent b411246 commit b6abb90
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class UrlMappings {
"/old-controller-action-with-params"(redirect: [controller: 'baz', action: 'newUrl', keepParamsWhenRedirect: true])
"/new-url"(controller: 'baz', 'action': 'newUrl')

"/forward/$param1"(controller: 'forwarding', action: 'two')

"/"(view:"/index")
"500"(view:'/error')
"404"(controller:"errors", action:"notFound")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@ import grails.testing.mixin.integration.Integration
@Integration(applicationClass = Application)
@Rollback
class ForwardingSpec extends ContainerGebSpec {
void "params extracted from the URL path by a custom UrlMapping are forwarded"() {
when: 'a url mapping such as /forward/$param1 is matched'
go '/forward/test'
then: 'param1 is passed to the forwarded action'
$().text() == 'Forward Destination. Params: test'
}

void "verifies params from the original url are passed to the forwarded action but not duplicated"() {
when:
go '/forwarding/two?param1=test'
then:
$().text() == 'Forward Destination. Params: test'
}

void "Test forward to same controller"() {
when:"A forward is issued to an action in the same controller"
Expand Down

0 comments on commit b6abb90

Please sign in to comment.