Skip to content

Commit eda109f

Browse files
committed
GRAILS-7022 small backwards compatibility 'fix'
1 parent 5dd3379 commit eda109f

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/java/grails/test/MockUtils.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ class MockUtils {
203203

204204
modelAndView.viewName = map["view"]
205205
modelAndView.addAllObjects(map["model"])
206+
return map["model"] // backwards compatibility for GRAILS-7022 - shouldn't ordinarily be referenced, use renderArgs instead
206207
}
207208
else if (map["text"] != null) {
208209
delegate.response.outputStream << map["text"]

src/test/grails/test/MockUtilsTests.groovy

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,18 @@ class MockUtilsTests extends GroovyTestCase {
758758
assertEquals(101, controller.modelAndView.model.count)
759759
}
760760

761+
/**
762+
* Test for GRAILS-7022
763+
*/
764+
void testGRAILS7022() {
765+
MockUtils.mockController(TestController)
766+
767+
def controller = new TestController()
768+
769+
def returnValue = controller.render(view: "list", model: [count: 101])
770+
assertTrue returnValue instanceof Map
771+
}
772+
761773
/**
762774
* Tests that the render method used for templates populates the
763775
* "renderArgs" map with the given values.

0 commit comments

Comments
 (0)