Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # using dry-validation (0.9.5)
- test_1 = Dry::Validation.Schema { required(:param_1) { format?(/^[A-Z]+$/) } }
- test_1.call({ param_1: 'SOMETHINGLONGERA'}).messages
- => {}
- test_2 = Dry::Validation.Schema { required(:param_1) { max_size?(15) & format?(/^[A-Z]+$/) } }
- test_2.call({ param_1: 'SOMETHINGLONGERA'}).messages
- Got :
- => {:param_1=>["size cannot be greater than 15", "is in invalid format"]}
- Expected :
- => {:param_1=>["size cannot be greater than 15"]}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement