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
void testSomething() {
def author = new Author(firstName:'foo', lastName: 'bar')
author.save()
assert author.id != null
assert author.books == null
def book1 = new Book(title: 'grails', price: 43, published: new Date(), author: author)
assert author.books == null
// add the book to the author to complete the other side
author.addToBooks(book1)
assert author.books.size() == 1
author.save()
// WTF! Books size is 2 after the author save?!?
assert author.books.size() == 1
}
}
{code}
The same test fails in unit and integration tests in 2.0.1.
The text was updated successfully, but these errors were encountered:
graemerocher said:
Well, this is not really a bug, because Grails will automatically link the association, and List allows duplicates.. not sure at this stage
Original Reporter: tednaleid
Environment: mac osx grails 2.0.1
Version: 2.0.1
Migrated From: http://jira.grails.org/browse/GRAILS-8815
If you have an Author that has a List of Book objects:
doublesave.Author:
{code}
package doublesave
class Author {
String firstName
String lastName
}
{code}
doublesave.Book:
{code}
package doublesave
class Book {
String title
Date published
BigDecimal price
}
{code}
It will re-add a book to the list whenever the Author is saved:
{code}
package doublesave
import grails.test.mixin.*
import org.junit.*
@testfor(Author)
class AuthorTests {
}
}
{code}
The same test fails in unit and integration tests in 2.0.1.
The text was updated successfully, but these errors were encountered: