Sha256: 6a3a51c40585bb4fe9552772fd8864abaa6d4aa00fb037b90aeb2f567b184c25
Contents?: true
Size: 1.22 KB
Versions: 21
Compression:
Stored size: 1.22 KB
Contents
require 'spec_helper' class Predicate describe And, "attr_split" do let(:tautology){ Factory.tautology } subject{ predicate.attr_split } context 'when each side returns a singleton hash' do let(:predicate){ Factory.eq(:x, 2) & Factory.eq(:y, 3) } it 'returns the hash union' do expect(subject).to eql({ :x => Factory.eq(:x, 2), :y => Factory.eq(:y, 3) }) end end context 'when right and left side share some attributes' do let(:predicate){ Factory.eq(:x, 2) & ( Factory.eq(:y, 3) & Factory.in(:x, [1, 18]) ) } it 'returns the hash union' do expect(subject).to eql({ :x => Factory.eq(:x, 2) & Factory.in(:x, [1, 18]), :y => Factory.eq(:y, 3) }) end end context 'when right and left side share some attributes, but split cannot be made' do let(:predicate){ Factory.eq(:x, 2) & ( Factory.eq(:y, 3) | Factory.in(:x, [1, 18]) ) } it 'returns the hash union' do expect(subject).to eql({ :x => Factory.eq(:x, 2), nil => Factory.eq(:y, 3) | Factory.in(:x, [1, 18]) }) end end end end
Version data entries
21 entries across 21 versions & 1 rubygems