Skip to content

Instantly share code, notes, and snippets.

@ishults
Last active December 16, 2015 20:06
Show Gist options
  • Select an option

  • Save ishults/2e398a4e8510d89829be to your computer and use it in GitHub Desktop.

Select an option

Save ishults/2e398a4e8510d89829be to your computer and use it in GitHub Desktop.
Criteria Spec
class CriteriaIntegrationSpec extends IntegrationSpec {
void "Nested criteria property ordering should ignoreCase properly"() {
given: 'A parent class and its child classes'
Parent parent = new Parent().save()
Child child1 = new Child(age: 100, name: 'Apollo', parent: parent).save()
Child child2 = new Child(age: 200, name: 'Zeus', parent: parent).save()
Child child3 = new Child(age: 300, name: 'athena', parent: parent).save()
when: 'a criteria call is ordered by a String property'
List names = Parent.createCriteria().list() {
children {
eq('parent', parent)
gt('age', 50)
projections {
property('name')
}
order('name')
}
}
then: 'it does not sort case-insensitively by default'
assert names == [ 'Apollo', 'Zeus', 'athena' ]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment