Created
March 25, 2012 21:05
-
-
Save juandebravo/2199750 to your computer and use it in GitHub Desktop.
client validation
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
obj = ParamsValidator::Request.new | |
obj[:data] = "this is a log" | |
obj[:level] = 1 | |
ruleset = MockObject.get_rule(:method2) | |
obj.valid?(ruleset) # false | |
begin | |
obj.validate(ruleset) | |
rescue ArgumentError => ae | |
p ae.message # array with validation errors | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment