You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using def users = User.list(sort: 'loginId', order: 'asc', max: 5, fetch: [posts: 'eager']) the result list has 3 items whereas def users = User.list(sort: 'loginId', order: 'asc', max: 5) has 5.
I wonder if this is a bug in grails (version 2.2.3) ?
Here is a spec that should pass but where the tests using the fetch parameter are failing:
package com.grailsinaction
import grails.plugin.spock.IntegrationSpec
/**
* Integration tests that should pass, but the one specifying fetch parameter to list() fails.
*/
class UserIntegrationCh531Spec extends IntegrationSpec {
def setup() {
}
def cleanup() {
}
def "Static User list with sorting order"() {
given: "User domain static list() method is used with parameters sort and order"
def users = User.list(sort: 'id', order: 'asc')
when: "a copy of the list is sorted by id"
def copy = users.collect().sort { it.id }
then: "both are equals"
users == copy
}
def "Static User list with sorting order and eager fetch"() {
given: "User domain static list() method is used with parameters sort, order and fetch"
def users = User.list(sort: 'id', order: 'asc', fetch: [posts: 'eager'])
when: "a copy of the list is sorted by id"
def copy = users.collect().sort { it.id }
then: "both are equals"
users == copy
}
def "Static User list with max"() {
given: "User domain static list() method used with a max parameter"
def max = 4
def users = User.list(max: max)
when: "We count the results"
def count = users.size()
then: "it equals the max given"
count == max
}
def "Static User list with max and eager fetch"() {
given: "User domain static list() method used with a max parameter and fetch"
def max = 5
def users = User.list(max: max, fetch: [posts: 'eager'])
when: "We count the results"
def count = users.size()
then: "it equals the max given"
count == max
}
}
The text was updated successfully, but these errors were encountered:
Odd. I have just tried this and it's working fine with Grails 2.2.3. I simply can't reproduce. I assume you're running against H2? I wonder if the version of the JDK is having an impact too. I've just tried with Java 6.
When using
def users = User.list(sort: 'loginId', order: 'asc', max: 5, fetch: [posts: 'eager'])
the result list has 3 items whereasdef users = User.list(sort: 'loginId', order: 'asc', max: 5)
has 5.I wonder if this is a bug in grails (version 2.2.3) ?
Here is a spec that should pass but where the tests using the
fetch
parameter are failing:The text was updated successfully, but these errors were encountered: