Sha256: 76cd28e726ae7586e8cd223239cc1f0d77e661109607e95331893bb41fe3569a
Contents?: true
Size: 737 Bytes
Versions: 5
Compression:
Stored size: 737 Bytes
Contents
RSpec.describe Rule::Composite::Conjunction do include_context 'predicates' subject(:rule) { Rule::Composite::Conjunction.new(left, right) } let(:left) { Rule::Value.new(:age, int?) } let(:right) { Rule::Value.new(:age, gt?.curry(18)) } describe '#call' do it 'calls left and right' do expect(rule.(18)).to be_failure end end describe '#and' do let(:other) { Rule::Value.new(:age, lt?.curry(30)) } it 'creates conjunction with the other' do expect(rule.and(other).(31)).to be_failure end end describe '#or' do let(:other) { Rule::Value.new(:age, lt?.curry(14)) } it 'creates disjunction with the other' do expect(rule.or(other).(13)).to be_success end end end
Version data entries
5 entries across 5 versions & 1 rubygems