Sha256: a11fa8f61313c1f9bcef3596dc310fce7bd121cf909e708c1286f8d11c044d83
Contents?: true
Size: 579 Bytes
Versions: 5
Compression:
Stored size: 579 Bytes
Contents
RSpec.describe Dry::Validation::Schema, 'for an array' do subject(:schema) do Dry::Validation.Schema do each do key(:prefix).required key(:value).required end end end it 'applies its rules to array input' do result = schema.([{ prefix: 1, value: 123 }, { prefix: 2, value: 456 }]) expect(result).to be_success result = schema.([{ prefix: 1, value: nil }, { prefix: nil, value: 456 }]) expect(result.messages).to eql( 0 => { value: ["must be filled"] }, 1 => { prefix: ["must be filled"] } ) end end
Version data entries
5 entries across 5 versions & 1 rubygems