-
Notifications
You must be signed in to change notification settings - Fork 951
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
18 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,29 +82,29 @@ class TestingValidationSpec extends Specification implements DomainUnitTest<Pers | |
given: | ||
def person = new Person(name: 'Jeff', age: 42, email: '[email protected]') | ||
|
||
when: | ||
person.properties = [age: 'some string', name: 'Jeff Scott Brown', email: 'abcdefgh'] | ||
when: | ||
person.properties = [age: 'some string', name: 'Jeff Scott Brown', email: 'abcdefgh'] | ||
|
||
then: | ||
1 == person.errors.errorCount | ||
then: | ||
1 == person.errors.errorCount | ||
|
||
when: | ||
def ageError = person.errors.getFieldError('age') | ||
when: | ||
def ageError = person.errors.getFieldError('age') | ||
|
||
then: | ||
'some string' == ageError.rejectedValue | ||
then: | ||
'some string' == ageError.rejectedValue | ||
|
||
when: | ||
person.validate() | ||
def errorCount = person.errors.errorCount | ||
ageError = person.errors.getFieldError('age') | ||
def emailError = person.errors.getFieldError('email') | ||
when: | ||
person.validate() | ||
def errorCount = person.errors.errorCount | ||
ageError = person.errors.getFieldError('age') | ||
def emailError = person.errors.getFieldError('email') | ||
|
||
then: | ||
errorCount == 2 | ||
'typeMismatch' in ageError.codes | ||
'person.email.email.error' in emailError.codes | ||
'some string' == ageError.rejectedValue | ||
then: | ||
errorCount == 2 | ||
'typeMismatch' in ageError.codes | ||
'person.email.email.error' in emailError.codes | ||
'some string' == ageError.rejectedValue | ||
} | ||
} | ||
|
||
|