Sha256: b1f4f2335d6859fbfeada36703c23906fa17d3d7385c5bc645bdb7efa66bcc39

Contents?: true

Size: 1.74 KB

Versions: 17

Compression:

Stored size: 1.74 KB

Contents

RSpec.describe 'Predicates: Key' do
  context 'with required' do
    it "raises error" do
      expect { Dry::Validation.Form { required(:foo) { key? } } }.to raise_error InvalidSchemaError
    end
  end

  context 'with optional' do
    it "raises error" do
      expect { Dry::Validation.Form { optional(:foo) { key? } } }.to raise_error InvalidSchemaError
    end
  end

  context 'as macro' do
    context 'with required' do
      context 'with value' do
        it "raises error" do
          expect { Dry::Validation.Form do
            required(:foo).value(:key?)
          end }.to raise_error InvalidSchemaError
        end
      end

      context 'with filled' do
        it "raises error" do
          expect { Dry::Validation.Form do
            required(:foo).filled(:key?)
          end }.to raise_error InvalidSchemaError
        end
      end

      context 'with maybe' do
        it "raises error" do
          expect { Dry::Validation.Form do
            required(:foo).maybe(:key?)
          end }.to raise_error InvalidSchemaError
        end
      end
    end

    context 'with optional' do
      context 'with value' do
        it "raises error" do
          expect { Dry::Validation.Schema do
            optional(:foo).value(:key?)
          end }.to raise_error InvalidSchemaError
        end
      end

      context 'with filled' do
        it "raises error" do
          expect { Dry::Validation.Schema do
            optional(:foo).filled(:key?)
          end }.to raise_error InvalidSchemaError
        end
      end

      context 'with maybe' do
        it "raises error" do
          expect { Dry::Validation.Schema do
            optional(:foo).maybe(:key?)
          end }.to raise_error InvalidSchemaError
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
dry-validation-0.11.2 spec/integration/form/predicates/key_spec.rb
dry-validation-0.11.1 spec/integration/form/predicates/key_spec.rb
dry-validation-0.11.0 spec/integration/form/predicates/key_spec.rb
dry-validation-0.10.7 spec/integration/form/predicates/key_spec.rb
dry-validation-0.10.6 spec/integration/form/predicates/key_spec.rb
dry-validation-0.10.5 spec/integration/form/predicates/key_spec.rb
dry-validation-0.10.4 spec/integration/form/predicates/key_spec.rb
dry-validation-0.10.3 spec/integration/form/predicates/key_spec.rb
dry-validation-0.10.2 spec/integration/form/predicates/key_spec.rb
dry-validation-0.10.1 spec/integration/form/predicates/key_spec.rb
dry-validation-0.10.0 spec/integration/form/predicates/key_spec.rb
dry-validation-0.9.5 spec/integration/form/predicates/key_spec.rb
dry-validation-0.9.4 spec/integration/form/predicates/key_spec.rb
dry-validation-0.9.3 spec/integration/form/predicates/key_spec.rb
dry-validation-0.9.2 spec/integration/form/predicates/key_spec.rb
dry-validation-0.9.1 spec/integration/form/predicates/key_spec.rb
dry-validation-0.9.0 spec/integration/form/predicates/key_spec.rb