Sha256: 40e7a03e59ca8cf897669cbf8cea43c9891f8e75320d819af8c4fa736af459a6

Contents?: true

Size: 868 Bytes

Versions: 37

Compression:

Stored size: 868 Bytes

Contents

require 'dry/validation/messages/i18n'

RSpec.describe Schema do
  describe '.messages' do
    context 'with default setting' do
      let(:schema) do
        Class.new(Schema)
      end

      it 'returns default yaml messages' do
        expect(schema.messages).to be_instance_of(Messages::YAML)
      end
    end

    context 'with i18n setting' do
      let(:schema) do
        Class.new(Schema) { configure { config.messages = :i18n } }
      end

      it 'returns default i18n messages' do
        expect(schema.messages).to be_instance_of(Messages::I18n)
      end
    end

    context 'with an invalid setting' do
      let(:schema) do
        Class.new(Schema) { configure { config.messages = :oops } }
      end

      it 'returns default i18n messages' do
        expect { schema.messages }.to raise_error(RuntimeError, /oops/)
      end
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
dry-validation-0.13.3 spec/unit/schema_spec.rb
dry-validation-0.13.2 spec/unit/schema_spec.rb
dry-validation-0.13.1 spec/unit/schema_spec.rb
dry-validation-0.11.2 spec/unit/schema_spec.rb
dry-validation-0.12.3 spec/unit/schema_spec.rb
dry-validation-0.13.0 spec/unit/schema_spec.rb
dry-validation-0.12.2 spec/unit/schema_spec.rb
dry-validation-0.12.1 spec/unit/schema_spec.rb
dry-validation-0.12.0 spec/unit/schema_spec.rb
dry-validation-0.11.1 spec/unit/schema_spec.rb
dry-validation-0.11.0 spec/unit/schema_spec.rb
dry-validation-0.10.7 spec/unit/schema_spec.rb
dry-validation-0.10.6 spec/unit/schema_spec.rb
dry-validation-0.10.5 spec/unit/schema_spec.rb
dry-validation-0.10.4 spec/unit/schema_spec.rb
dry-validation-0.10.3 spec/unit/schema_spec.rb
dry-validation-0.10.2 spec/unit/schema_spec.rb
dry-validation-0.10.1 spec/unit/schema_spec.rb
dry-validation-0.10.0 spec/unit/schema_spec.rb
dry-validation-0.9.5 spec/unit/schema_spec.rb