Sha256: 7bfba813ae2f70e78394593872f31393f5b478206ef878383bcb1cb74555f290
Contents?: true
Size: 1.34 KB
Versions: 5
Compression:
Stored size: 1.34 KB
Contents
require 'spec_helper' module Alf module Operator::Relational describe Minus do let(:operator_class){ Minus } it_should_behave_like("An operator class") let(:left) {[ {:sid => 'S1', :city => 'London'}, {:sid => 'S2', :city => 'Paris'}, {:sid => 'S3', :city => 'Paris'} ]} let(:right) {[ {:sid => 'S2', :city => 'Paris'}, {:sid => 'S1', :city => 'London'}, ]} let(:disjoint) {[ {:sid => 'S4', :city => 'Oslo'}, {:sid => 'S5', :city => 'Bruxelles'}, ]} let(:operator){ Lispy.minus(*args) } subject{ operator.to_a } context "when applied on the same operand twice" do let(:args){ [left, left] } it { should be_empty } end context "when applied on operands sharing tuples" do let(:args){ [left, right] } let(:expected) {[ {:sid => 'S3', :city => 'Paris'} ]} it { should eq(expected) } end context "when applied on disjoint operands" do let(:args){ [left, disjoint] } it { should eq(left) } end context "when factored with Lispy" do let(:operator){ Lispy.minus(left, right) } let(:expected) {[ {:sid => 'S3', :city => 'Paris'} ]} it { should eq(expected) } end end end end
Version data entries
5 entries across 5 versions & 1 rubygems