Sha256: 40c1457fe73063fe247eb211ec14c56b97344dfe4537343e9413a7b90875d972

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

require 'spec_helper'
module Alf
  module Operator::Relational
    describe NotMatching::HashBased do
        
      let(:suppliers) {Alf::Relation[
        {:sid => 'S1', :city => 'London'},
        {:sid => 'S2', :city => 'Paris'},
        {:sid => 'S3', :city => 'Paris'}
      ]}
  
      let(:operator){ NotMatching::HashBased.new }
      subject{ operator.to_rel }

      describe "when applied on itself" do
        before{ operator.datasets = [suppliers, suppliers] }
        it { should eq(suppliers.minus(suppliers)) }
      end
  
      describe "when applied against a subset" do
        before{ operator.datasets = [suppliers, Alf::Relation[{:sid => 'S1'}]] }
        it { should eq(suppliers.restrict(lambda{ sid != 'S1' })) }
      end
      
      describe "against DEE" do
        before{ operator.datasets = [suppliers, Relation::DEE] }
        it { should eq(Relation::DUM) }
      end
      
      describe "against DUM" do
        before{ operator.datasets = [suppliers, Relation::DUM] }
        it { should eq(suppliers) }
      end

    end 
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alf-0.9.3 spec/unit/operator/relational/not_matching/test_hash_based.rb