Skip to content

Instantly share code, notes, and snippets.

@juandebravo
Created March 25, 2012 21:05
Show Gist options
  • Save juandebravo/2199750 to your computer and use it in GitHub Desktop.
Save juandebravo/2199750 to your computer and use it in GitHub Desktop.
client validation
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