Sha256: e987e005baa964922cbcdf4eff7a1e0fd7fe71ce496869925f9de13eb79164b9
Contents?: true
Size: 1.28 KB
Versions: 1
Compression:
Stored size: 1.28 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Algebra::Rename, '#insert' do subject { object.insert(other) } let(:object) { described_class.new(operand, aliases) } let(:operand) { Relation.new([ [ :id, Integer ] ], LazyEnumerable.new([ [ 1 ] ])) } let(:other_relation) { Relation.new(header, LazyEnumerable.new([ [ 2 ] ])) } let(:aliases) { described_class::Aliases.coerce(operand.header, :id => :other_id) } let(:header) { [ [ :other_id, Integer ] ] } shared_examples_for 'Algebra::Rename#insert' do it { should be_instance_of(described_class) } its(:operand) { should be_kind_of(Relation) } its(:header) { should == header } its(:aliases) { should eql(aliases) } it 'inserts the tuples' do should == [ [ 1 ], [ 2 ] ] end end context 'with a relation' do let(:other) { other_relation } it_should_behave_like 'Algebra::Rename#insert' end context 'with an array of tuples' do let(:other) { other_relation.to_a } it_should_behave_like 'Algebra::Rename#insert' end context 'with an array of arrays' do let(:other) { other_relation.map(&:to_ary) } it_should_behave_like 'Algebra::Rename#insert' end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
axiom-0.1.0 | spec/unit/axiom/algebra/rename/insert_spec.rb |