Grails

Reference needs update due to altered semantics of grails.test.MockUtils

Details

  • Type: Task Task
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.1.1
  • Fix Version/s: 1.2 final
  • Component/s: Documentation, Testing
  • Labels:
    None

Description

The behaviour of method grails.test.MockUtils.mockDomain was changed in release 1.1.1 (possibly caused by fix for issue GRAILS-4495).
A list that is passed as a method parameter does no longer reflect changes (adding/removing of instances) to the mocked domain.
Unit tests that check for addition/removal of domain instances by using the initial list will fail with the current release (see example below).
Some code examples in the Grails reference documentation still propagate this usage pattern (e.g. in chapter 9.1, section 'The Testing Framework') and should be updated.

Example:
class MyServiceTests extends GrailsUnitTestCase {
void testCreateSomething() { def testInstances = [] mockDomain(Item, testInstances) //do something, e.g. create a new domain instance assertEquals 1, testInstances }
}

Activity

Hide
Graeme Rocher added a comment -

Assigning all documentation related issues to 1.2 final since they don't represent a change to the codebase

Show
Graeme Rocher added a comment - Assigning all documentation related issues to 1.2 final since they don't represent a change to the codebase

People

Vote (2)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: