Sha256: a059a9f9d643e9e180c1d98cd4b33774dbc77d493570c1220569b8d38e212f1a
Contents?: true
Size: 1.78 KB
Versions: 1
Compression:
Stored size: 1.78 KB
Contents
require 'spec_helper' module Alf module Operator::Relational describe Matching::HashBased do let(:suppliers) {Alf::Relation[ {:sid => 'S1', :city => 'London'}, {:sid => 'S2', :city => 'Paris'}, {:sid => 'S3', :city => 'Paris'} ]} let(:statuses) {Alf::Relation[ {:sid => 'S1', :status => 20}, {:sid => 'S2', :status => 10}, {:sid => 'S3', :status => 30} ]} let(:countries) {Alf::Relation[ {:city => 'London', :country => 'England'}, {:city => 'Paris', :country => 'France'}, {:city => 'Bruxelles', :country => 'Belgium (until ?)'} ]} let(:operator){ Matching::HashBased.new } subject{ operator.to_rel } describe "when applied on both candidate keys" do before{ operator.datasets = [suppliers, statuses] } it { should eq(suppliers) } end describe "when applied on a typical foreign key" do describe "on one way" do before{ operator.datasets = [suppliers, countries] } it { should eq(suppliers) } end describe "on the other way around" do before{ operator.datasets = [countries, suppliers] } it { should eq(countries.restrict(lambda{ city != 'Bruxelles' })) } end end describe "when no attributes are in common" do before{ operator.datasets = [statuses, countries] } it { should eq(statuses) } end describe "against DEE" do before{ operator.datasets = [suppliers, Relation::DEE] } it { should eq(suppliers) } end describe "against DUM" do before{ operator.datasets = [suppliers, Relation::DUM] } it { should eq(Relation::DUM) } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
alf-0.9.3 | spec/unit/operator/relational/matching/test_hash_based.rb |