Sha256: 98cecc8f411e5bc59c2be04bb5a47735db6e0809c5158320a7f5c3711363e0c0

Contents?: true

Size: 608 Bytes

Versions: 6

Compression:

Stored size: 608 Bytes

Contents

require 'dry/validation/predicates'

RSpec.describe Dry::Validation::Predicates do
  describe '#key?' do
    let(:predicate_name) { :key? }

    context 'when key is present in value' do
      let(:arguments_list) do
        [
          [:name, { name: 'John' }],
          [:age, { age: 18 }]
        ]
      end

      it_behaves_like 'a passing predicate'
    end

    context 'with key is not present in value' do
      let(:arguments_list) do
        [
          [:name, { age: 18 }],
          [:age, { name: 'Jill' }]
        ]
      end

      it_behaves_like 'a failing predicate'
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dry-validation-0.4.1 spec/unit/predicates/key_spec.rb
dry-validation-0.4.0 spec/unit/predicates/key_spec.rb
dry-validation-0.3.1 spec/unit/predicates/key_spec.rb
dry-validation-0.3.0 spec/unit/predicates/key_spec.rb
dry-validation-0.2.0 spec/unit/predicates/key_spec.rb
dry-validation-0.1.0 spec/unit/predicates/key_spec.rb