-
-
Notifications
You must be signed in to change notification settings - Fork 953
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/5.4.x' into 6.2.x
- Loading branch information
Showing
4 changed files
with
48 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...url-mappings/src/test/groovy/org/grails/web/mapping/DefaultUrlMappingEvaluatorSpec.groovy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.grails.web.mapping | ||
|
||
import grails.web.mapping.UrlMapping | ||
import spock.lang.Specification | ||
|
||
class DefaultUrlMappingEvaluatorSpec extends Specification { | ||
|
||
void "test evaluate mapping: #logicalUrls to view: #viewName, controller: #controllerName, action: #actionName, uri: #forwardURI as #clazz.simpleName"() { | ||
given: | ||
DefaultUrlMappingEvaluator defaultUrlMappingEvaluator = new DefaultUrlMappingEvaluator(null) | ||
|
||
when: | ||
List<UrlMapping> mappings = defaultUrlMappingEvaluator.evaluateMappings closure | ||
|
||
then: | ||
mappings.size() == 1 | ||
mappings[0].urlData.logicalUrls == logicalUrls | ||
mappings[0].class == clazz | ||
mappings[0].viewName == viewName | ||
mappings[0].controllerName == controllerName | ||
mappings[0].actionName == actionName | ||
mappings[0].forwardURI == forwardURI | ||
|
||
where: | ||
closure | logicalUrls | viewName | controllerName | actionName | forwardURI | clazz | ||
({ '/lorem/ipsum'(view: '/foobar') }) | ['/lorem/ipsum'] | '/foobar' | null | null | null | RegexUrlMapping.class | ||
({ '/lorem/ipsum'(controller: 'foo', action: 'bar') }) | ['/lorem/ipsum'] | null | 'foo' | 'bar' | null | RegexUrlMapping.class | ||
({ '/lorem/ipsum'(uri: '/foo/bar') }) | ['/lorem/ipsum'] | null | null | null | new URI('/foo/bar') | RegexUrlMapping.class | ||
({ '404'(view: '/foobar') }) | ['404'] | '/foobar' | null | null | null | ResponseCodeUrlMapping.class | ||
({ '404'(controller: 'foo', action: 'bar') }) | ['404'] | null | 'foo' | 'bar' | null | ResponseCodeUrlMapping.class | ||
({ '404'(uri: '/foo/bar') }) | ['404'] | null | null | null | new URI('/foo/bar') | ResponseCodeUrlMapping.class | ||
} | ||
} |