Hi,
I use Grails 3.3.8 and build-test-data:3.3.1
I worte following Integration test code. comments explain this problem.
def sample () {
setup:
assert RoomType.count == 0 // it will be "0". no problem.
RoomType roomType1 = RoomType.build(save: false)
assert roomType1.id == null // no problem.
assert RoomType.count == 0 // this test fails... RoomType.count returns "1"
}
so, Grails's test report shows such as following message.
Condition not satisfied:
RoomType.count == 0 // this test fails... RoomType.count returns "1"
| |
1 false
I think that the following actions are originally correct:
RomoType.build(save: false) creates a instance of RoomType domain of Grails.
- But not save into data store(I use H2 for Integration test), because be specified
save: false in build method.
However, like a above my sample code, that instance saves immediately.
Is this behavior correct? or i understand it wrong?
Hi,
I use Grails
3.3.8andbuild-test-data:3.3.1I worte following Integration test code. comments explain this problem.
so, Grails's test report shows such as following message.
I think that the following actions are originally correct:
RomoType.build(save: false)creates a instance of RoomType domain of Grails.save: falsein build method.However, like a above my sample code, that instance saves immediately.
Is this behavior correct? or i understand it wrong?