Sha256: 9b79502a4fe1567211431dd400eb763ef1eadcd085e7e91378abdd0bedfbc807
Contents?: true
Size: 1.08 KB
Versions: 5
Compression:
Stored size: 1.08 KB
Contents
require 'dry/validation/messages/i18n' RSpec.describe Dry::Validation do shared_context 'schema with customized messages' do describe '#messages' do it 'returns compiled error messages' do expect(schema.(email: '').messages).to eql( email: ['Please provide your email'] ) end end end context 'yaml' do subject(:schema) do Dry::Validation.Schema do configure do config.messages_file = SPEC_ROOT.join('fixtures/locales/en.yml') end key(:email, &:filled?) end end include_context 'schema with customized messages' end context 'i18n' do context 'with custom messages set globally' do before do I18n.load_path << SPEC_ROOT.join('fixtures/locales/en.yml') I18n.backend.load_translations end subject(:schema) do Dry::Validation.Schema do configure do config.messages = :i18n end key(:email, &:filled?) end end include_context 'schema with customized messages' end end end
Version data entries
5 entries across 5 versions & 1 rubygems