Matcher for custom validator #68

Merged
merged 2 commits into from May 24, 2012

Projects

None yet

2 participants

@nessche
nessche commented May 24, 2012

I have added a matcher for custom validator. In other words it is possible to see if a field is being validated by a custom validator, check the class of the custom validator and the message it generates.

Currently the syntax (explained in the updated README.rd) is

it { should custom_validate(:my_field).with_validator(TheCustomValidator) }

but feel free to rename the matcher and methods if you find better/more appropriate names.

I have also added a dummy custom validator, a model (Person) and some tests to verify the new functionality.

@evansagge evansagge merged commit b2bcfe7 into mongoid-rspec:master May 24, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment