Grails
  1. Grails
  2. GRAILS-787 Top level task: Improve Grails unit testing support
  3. GRAILS-3552

Unique Constraint doesn't account for update to existing item in list of testInstances

    Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.1-beta1
    • Component/s: Testing
    • Labels:
      None
    • Patch Submitted:
      Yes

      Description

      Assuming a unique constraint defined on 'userId' - this code fails, there is a 'unique' validation error on the userId property

      mockDomain(User, [new User(userId:'mike', password:'asldkfjh')])
      
      User u = User.findByUserId('mike')
      assertNotNull u
      
      u.save()
      assertFalse u.hasErrors()
      

      MockUtils should check to see if there is a uniqueness error on object other than itself. Patch attached with possible solution.

        Activity

        Hide
        Peter Ledbrook added a comment -

        Patch applied and unit tests updated. Thanks Mike!

        Show
        Peter Ledbrook added a comment - Patch applied and unit tests updated. Thanks Mike!
        Hide
        Graeme Rocher added a comment -

        Bulk closing bunch of resolved issues

        Show
        Graeme Rocher added a comment - Bulk closing bunch of resolved issues

          People

          • Assignee:
            Peter Ledbrook
            Reporter:
            Mike Hugo
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development