Sha256: 3645cf9c9ad7ff2de748f5c712ed16e7683c14d0bfbee7d76bc05232cb312fbf
Contents?: true
Size: 1.52 KB
Versions: 4
Compression:
Stored size: 1.52 KB
Contents
require 'spec_helper' 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){ [:x, :y] } it{ should eq([predicate, tautology]) } end context 'when not covered at all' do let(:list){ [:name] } it{ should eq([tautology, predicate]) } end context 'when partially covered' do let(:list){ [: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){ [:x, :y, :z] } it{ should eq([predicate, tautology]) } end context 'when not covered at all' do let(:list){ [:name] } it{ should eq([tautology, predicate]) } end context 'when partially covered but split-able' do let(:list){ [:x] } it{ should eq([Factory.eq(:x, 2), Factory.eq(:y, :z)]) } end context 'when partially covered but split-able (2)' do let(:list){ [:y] } it{ should eq([Factory.eq(:y, :z), Factory.eq(:x, 2)]) } end context 'when partially covered but not split-able' do let(:list){ [:x, :y] } it{ should eq([predicate, tautology]) } end end end end
Version data entries
4 entries across 4 versions & 1 rubygems