1: void testEditExistingBusiness() { 2: def user = new User(username : 'tommy') 3: user.save(validate: false) 4: def business = new Business(id : 1, user : user) 5: business.save(validate: false) 6: def securityMock = createSpringSecurityMock(user) 7: controller.springSecurityService = securityMock 8: params.id = business.id 9: def model = controller.edit() 10: assert model.businessInstance == business 11: }
That way you don't have to populate all of the User's and Business's required fields, which in this case is perfectly fine for my test.
No comments:
Post a Comment