Skip to content
Browse files

GRAILS-9040 - fix flash.now

flash.getNow() was working but flash.now was not.
  • Loading branch information...
1 parent d1635f6 commit b5432b2a9131cbf4b3375a208bc9bce959f09773 @jeffbrown jeffbrown committed Apr 19, 2012
View
18 ...te-web/src/test/groovy/org/codehaus/groovy/grails/web/servlet/GrailsFlashScopeSpec.groovy
@@ -0,0 +1,18 @@
+package org.codehaus.groovy.grails.web.servlet
+
+import spock.lang.Specification
+
+
+class GrailsFlashScopeSpec extends Specification {
+
+ void 'Test accessing flash.now as a property'() {
+ given:
+ def flash = new GrailsFlashScope()
+
+ when:
+ flash.now.title = 'Grails'
+
+ then:
+ 'Grails' == flash.now.title
+ }
+}
View
2 grails-web/src/main/groovy/org/codehaus/groovy/grails/web/servlet/GrailsFlashScope.java
@@ -135,6 +135,8 @@ public Set keySet() {
public Object get(Object key) {
if (next.containsKey(key)) {
return next.get(key);
+ } else if("now".equals(key)) {
+ return getNow();
}
return current.get(key);
}

0 comments on commit b5432b2

Please sign in to comment.
Something went wrong with that request. Please try again.