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
The same behavior is found in both unit and integration tests.
I wrote some tests that show some weird behavior. For instance,
if you push the where query into a closure, it works.
In the below test, the first expect line will pass, which runs the Where clause in a closure.
The 2nd expect line will fail, which runs the where query directly.
void "test where -- fails, and the sql doesn't filter by name"() {
given: "two things"
new Thing(name: "thing 1").save(flush: true, failOnError: true)
new Thing(name: "thing 2").save(flush: true, failOnError: true)
def queryClosure = { -> Thing.where { name == "thing 1" } }
expect:
queryClosure.call().list().size() == 1 // works
Thing.where { name == "thing 1" }.list().size() == 1 // fails
}
The text was updated successfully, but these errors were encountered:
Task List
Steps to Reproduce
expect: Thing.where { name == "thing 1" }.list().size() == 1
Expected Behaviour
The test should run a query similar to: "select ... from thing where this_.name=?"
and pass.
Actual Behaviour
The query runs a query similar to "select ... from thing", returns both things, and the test fails.
Environment Information
Example Application
git@github.com:tircnf/grailsWhereIntegrationTest.git
More information
The same behavior is found in both unit and integration tests.
I wrote some tests that show some weird behavior. For instance,
if you push the where query into a closure, it works.
In the below test, the first expect line will pass, which runs the Where clause in a closure.
The 2nd expect line will fail, which runs the where query directly.
The text was updated successfully, but these errors were encountered: