djcrankypants / spock

Automatically exported from code.google.com/p/spock
0 stars 0 forks source link

unable to run the test case for createCriteria() which uses creatAlias() and projections #310

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem? If possible, provide source code and
stack trace.
1.
2.
3.

What version of Spock and Groovy are you using?
spocck 0.7 and groovy 2.0

Please provide any additional information below. You can also assign
labels.

Original issue reported on code.google.com by naredla....@gmail.com on 17 Apr 2013 at 11:17

GoogleCodeExporter commented 8 years ago
Can you provide more information, like a reproducible self-contained example 
that demonstrates the problem?

Original comment by pe...@gradle.biz on 17 Apr 2013 at 2:12

GoogleCodeExporter commented 8 years ago
No signature of method: com.org.infoService.createAlias() is applicable for 
argument types: (java.lang.String, java.lang.String) values: ['user', user]

Original comment by naredla....@gmail.com on 18 Apr 2013 at 4:23

GoogleCodeExporter commented 8 years ago
I am able to reproduce the issue. Attached is a simple project with a failing 
spock test.

I have a domain with a transient value, that returns a list.

package com.nemnesic

class Hotel {
    String name
    static hasMany = [rooms: Room]

    static transients = ['reservations']

    def getReservations() {
        return Reservation.createCriteria().list() {
            createAlias('room', 'rm')
            and {
                eq('rm.hotel', this)
                or {
                    ge('checkInDate', new Date().clearTime())
                    ge('checkOutDate', new Date().clearTime())
                }

            }

        }

    }
}

Original comment by nemnesic@gmail.com on 16 Nov 2013 at 7:20

Attachments:

GoogleCodeExporter commented 8 years ago
This is Grails unit testing problem. It is not related to Spock: 
http://grails.1312388.n4.nabble.com/createAlias-in-gorm-unit-test-td4648894.html

Original comment by nemnesic@gmail.com on 17 Nov 2013 at 3:43