Sha256: 52e481100cfaf3ed435b5be4784aa0d982d7973ae8f3b702b8fb415990ded3d8
Contents?: true
Size: 1.61 KB
Versions: 1
Compression:
Stored size: 1.61 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Relation::Operation::Order, '#insert' do subject { object.insert(other) } let(:object) { described_class.new(relation, directions) } let(:relation) { Relation.new([attribute], LazyEnumerable.new([[1]])) } let(:attribute) { Attribute::Integer.new(:id) } let(:directions) { [attribute.desc] } context 'when other relation has matching directions' do let(:other) { other_base.sort_by(directions) } let(:other_base) { Relation.new([attribute], LazyEnumerable.new([[2]])) } it { should be_instance_of(described_class) } its(:operand) { should be_kind_of(Relation::Operation::Insertion) } it 'passes expected relations into the insertion' do subject = self.subject.operand subject.left.should be(relation) subject.right.should be(other_base) end its(:directions) { should == directions } it 'inserts the tuples' do should == [[2], [1]] end end context 'when other relation does not have the same directions' do let(:other) { Relation.new([attribute], LazyEnumerable.new([[2]])).sort_by([attribute]) } specify { expect { subject }.to raise_error(OrderMismatchError, 'other relation must have matching directions to be inserted') } end context 'when other relation is not an order' do let(:other) { Relation.new([attribute], LazyEnumerable.new([[2]])) } specify { expect { subject }.to raise_error(OrderMismatchError, 'other relation must have matching directions to be inserted') } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
axiom-0.1.1 | spec/unit/axiom/relation/operation/order/insert_spec.rb |