Sha256: b56758251aba902d304c38d1464b50e720feebf761e9dd176a1aa00c2cfcb838

Contents?: true

Size: 859 Bytes

Versions: 3

Compression:

Stored size: 859 Bytes

Contents

RSpec.describe Schema::Rule do
  let(:filled) { [:val, [:email, [:predicate, [:filled?, []]]]] }
  let(:format) { [:val, [:email, [:predicate, [:format?, [/regex/]]]]] }

  let(:left) { Schema::Rule.new(:email, filled) }
  let(:right) { Schema::Rule.new(:email, format) }

  describe '#and' do
    it 'returns a conjunction' do
      expect(left.and(right)).to match_array([:and, [filled, format]])
    end
  end

  describe '#or' do
    it 'returns a disjunction' do
      expect(left.or(right)).to match_array([:or, [filled, format]])
    end
  end

  describe '#xor' do
    it 'returns an exclusive disjunction' do
      expect(left.xor(right)).to match_array([:xor, [filled, format]])
    end
  end

  describe '#then' do
    it 'returns an implication' do
      expect(left.then(right)).to match_array([:implication, [filled, format]])
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dry-validation-0.5.0 spec/unit/schema/rule_spec.rb
dry-validation-0.4.1 spec/unit/schema/rule_spec.rb
dry-validation-0.4.0 spec/unit/schema/rule_spec.rb