Sha256: 522bbc09e934a5f86e1fa3520dda3ae7da690240719ce29a9e866ec62518630d

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'
module Alf
  class Predicate
    describe DyadicComp, "and_split" do

      let(:predicate){ Factory.eq(:id, 2) }
      let(:tautology){ Factory.tautology  }

      subject{ predicate.and_split(list) }

      context 'when included' do
        let(:list){ AttrList[:id, :name] }

        it{ should eq([predicate, tautology]) }
      end

      context 'when not include' do
        let(:list){ AttrList[:name] }

        it{ should eq([tautology, predicate]) }
      end

      context 'with attributes on both sides' do
        let(:predicate){ Factory.eq(:x, :y) }

        context 'when full at left' do
          let(:list){ AttrList[:x, :y] }
        
          it{ should eq([predicate, tautology]) }
        end
        
        context 'none at left' do
          let(:list){ AttrList[] }
        
          it{ should eq([tautology, predicate]) }
        end

        context 'mix' do
          let(:list){ AttrList[:y] }

          it{ should eq([predicate, tautology]) }
        end
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
alf-core-0.15.0 spec/unit/alf-predicate/nodes/dyadic_comp/test_and_split.rb
alf-core-0.14.0 spec/unit/alf-predicate/nodes/dyadic_comp/test_and_split.rb
alf-core-0.13.1 spec/unit/alf-predicate/nodes/dyadic_comp/test_and_split.rb
alf-core-0.13.0 spec/unit/alf-predicate/nodes/dyadic_comp/test_and_split.rb