Sha256: 36d5f718ea3037535c0f9e0b1faeaff5d632b5cfe9b9fbd78da99879ba680304
Contents?: true
Size: 1.68 KB
Versions: 4
Compression:
Stored size: 1.68 KB
Contents
require 'spec_helper' module Alf class Predicate describe And, "and_split" do let(:tautology){ Factory.tautology } subject{ predicate.and_split(list) } context 'when attributes on one side' do let(:predicate){ Factory.eq(:x, 2) & Factory.eq(:y, 3) } context 'when fully covered' do let(:list){ AttrList[:x, :y] } it{ should eq([predicate, tautology]) } end context 'when not covered at all' do let(:list){ AttrList[:name] } it{ should eq([tautology, predicate]) } end context 'when partially covered' do let(:list){ AttrList[:x] } it{ should eq([Factory.eq(:x, 2), Factory.eq(:y, 3)]) } end end context 'when attributes on both sides' do let(:predicate){ Factory.eq(:x, 2) & Factory.eq(:y, :z) } context 'when fully covered' do let(:list){ AttrList[:x, :y, :z] } it{ should eq([predicate, tautology]) } end context 'when not covered at all' do let(:list){ AttrList[:name] } it{ should eq([tautology, predicate]) } end context 'when partially covered but split-able' do let(:list){ AttrList[:x] } it{ should eq([Factory.eq(:x, 2), Factory.eq(:y, :z)]) } end context 'when partially covered but split-able (2)' do let(:list){ AttrList[:y] } it{ should eq([Factory.eq(:y, :z), Factory.eq(:x, 2)]) } end context 'when partially covered but not split-able' do let(:list){ AttrList[:x, :y] } it{ should eq([predicate, tautology]) } end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems