Grails - save () with MissingMethodExcepition error in integration test

I study groovy / grails and write my first integration test.

It currently does not work:

groovy.lang.MissingMethodException: No method signature: com.mangofactory.scurry.User.save () is applicable for argument types :() values: []

My test does nothing unusual:

class UserEventControllerTests extends ControllerUnitTestCase {
    protected void setUp() {
        super.setUp()
    }

    protected void tearDown() {
        super.tearDown()
    }

    void testAddingAUser()
    {
        def user = new User(emailAddress: "martypitt@test.com")
        user.save()
    }
}

Saving an object works great when I do this through scaffolding provided by grails.

What did I miss?

+3
source share
1 answer

If you want these to be integration tests, it should not distribute one of the unit test base classes, so change it to

class UserEventControllerTests extends GroovyTestCase {
...
}

and make sure that it is in the test / integration, and not in the test / block.

, ( UserEventControllerTests), ControllerUnitTestCase. , ( mockDomain ), , . .

10 : http://grails.org/doc/latest/

+3

Source: https://habr.com/ru/post/1794330/


All Articles