Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when updating a dynamic association in a newly created object #88

Open
jsolari56 opened this issue May 23, 2018 · 0 comments
Open

Comments

@jsolari56
Copy link
Contributor

This test also fails in master.

I created a PR for 6.0.x.BRINQA, but it might not be the best solution.

def "Test update newly created object"() {
    setup:
    def victor = new Pet(name: 'Victor')
    def fritz = new Pet(name: 'Fritz')
    def franz = new Pet(name: 'Franz')
    def heinrich = new Pet(name: 'Heinrich')
    victor.buddies = [fritz, franz]

    when:
    victor.save()
    heinrich.save()
    session.flush()

    then:
    victor.buddies.name.sort() == ['Franz', 'Fritz']

    when: "Adding an element"
    victor.buddies.add(heinrich)
    def cousin = victor.cousin

    then:
    victor.buddies.name.sort() == ['Franz', 'Fritz', 'Heinrich']

    when:
    victor.markDirty("buddies")
    victor.save()
    session.flush()
    victor.discard()
    victor = Pet.findByName("Victor")

    then:
    victor.buddies.name.sort() == ['Franz', 'Fritz', 'Heinrich']
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant