Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GRAILS-10979 - Fix support for binding to a collection of enum
- Loading branch information
Jeff Scott Brown
committed
Jan 14, 2014
1 parent
e914c1e
commit 2492b59
Showing
2 changed files
with
33 additions
and
0 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
30 changes: 30 additions & 0 deletions
30
...databinding/src/test/groovy/org/grails/databinding/SimpleDataBinderEnumBindingSpec.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,30 @@ | ||
package org.grails.databinding | ||
|
||
import spock.lang.Issue | ||
import spock.lang.Specification | ||
|
||
class SimpleDataBinderEnumBindingSpec extends Specification { | ||
@Issue('GRAILS-10979') | ||
void 'Test binding to a List of enum'() { | ||
given: | ||
def binder = new SimpleDataBinder() | ||
def holder = new HatSizeHolder() | ||
|
||
when: | ||
binder.bind holder, ['sizes[0]': 'LARGE', 'sizes[1]': 'SMALL'] as SimpleMapDataBindingSource | ||
|
||
then: | ||
holder.sizes?.size() == 2 | ||
holder.sizes[0] == HatSize.LARGE | ||
holder.sizes[1] == HatSize.SMALL | ||
} | ||
|
||
} | ||
|
||
enum HatSize { | ||
SMALL, MEDIUM, LARGE | ||
} | ||
|
||
class HatSizeHolder { | ||
List<HatSize> sizes | ||
} |