Sha256: c3be0c3f717b0a5dcc7fa59240e236756764cf4273e186bb8eaa9591a6b3df37
Contents?: true
Size: 1.6 KB
Versions: 1
Compression:
Stored size: 1.6 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Algebra::Extension, '#delete' do subject { object.delete(other) } let(:object) { described_class.new(operand, extensions) } let(:operand) { Relation.new(header, LazyEnumerable.new([ [ 1 ], [ 2 ] ])) } let(:extensions) { { extension_attr => 1 } } let(:extension_attr) { Attribute::Integer.new(:test) } let(:header) { [ [ :id, Integer ] ] } context 'when other relation has matching extensions' do let(:other) do Relation.new(header, LazyEnumerable.new([ [ 2 ] ])).extend do |context| context.add(:test, 1) end end it { should be_instance_of(described_class) } its(:operand) { should be_kind_of(Relation) } its(:header) { should == [ [ :id, Integer ], [ :test, Integer ] ] } it 'deletes the tuples' do should == [ [ 1, 1 ] ] end end context 'when other relation does not have the same extensions' do let(:other) do Relation.new(header, LazyEnumerable.new([ [ 2 ] ])).extend do |context| context.add(:test, 2) end end specify { expect { subject }.to raise_error(ExtensionMismatchError, 'other relation must have matching extensions to be deleted') } end context 'when other relation is not an extension' do let(:other) { Relation.new(header, LazyEnumerable.new([ [ 2 ] ])) } specify { expect { subject }.to raise_error(ExtensionMismatchError, 'other relation must have matching extensions to be deleted') } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
axiom-0.1.0 | spec/unit/axiom/algebra/extension/delete_spec.rb |