|
Hi,
I'm trying to make some integration tests, but it seems I can't modify data in my database. I populate my database (mysql) in the bootstrap.groovy. Here is my simple test : class ExponentIntegrationTests extends GroovyTestCase { protected void setUp() { super.setUp() } protected void tearDown() { super.tearDown() } void testSuppressExponent() { println(Exponent.count()) Exponent.get(2).delete() println(Exponent.count()) } } The test passe, but it write "3 - 3" -> the object Exponent hasn't been deleted. Any ideas ? |
|
One thing...
All the test are executed in the the test environment, this mean, the configuration that you have in the datasource is used, so if you have a DB in development this is ignored... Maybe you must specify the env...
Regards
2011/3/2 Piettes <[hidden email]> Hi, -- (¯`·._.·[Jµðn]·._.·´¯) |
|
In reply to this post by Piettes
On 2 March 2011 17:28, Piettes <[hidden email]> wrote:
> Hi, > > I'm trying to make some integration tests, but it seems I can't modify data > in my database. > I populate my database (mysql) in the bootstrap.groovy. > > Here is my simple test : > > class ExponentIntegrationTests extends GroovyTestCase { > protected void setUp() { > super.setUp() > } > protected void tearDown() { > super.tearDown() > } > > void testSuppressExponent() { > println(Exponent.count()) > Exponent.get(2).delete() > println(Exponent.count()) > } > } > > The test passe, but it write "3 - 3" -> the object Exponent hasn't been > deleted. > > Any ideas ? > Try a flush when you delete: Exponent.get(2).delete(flush: true) If that works then read: http://blog.springsource.com/2010/06/23/gorm-gotchas-part-1/ Shin --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
| Powered by Nabble | Edit this page |
