Sha256: 0cfb5baea5b7f24c09e6414a2b7e7aa158c3598ff4f82dd6c3c73421fea1d85c
Contents?: true
Size: 1.44 KB
Versions: 1
Compression:
Stored size: 1.44 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Algebra::Union, '#each' do subject { object.each { |tuple| yields << tuple } } let(:object) { described_class.new(left, right) } let(:left) { Relation.new(header, [[1]]) } let(:header) { [[:id, Integer]] } let(:yields) { [] } context 'with relations having similar bodies' do let(:right) { left.dup } it_should_behave_like 'an #each method' it 'yields only tuples' do subject yields.each { |tuple| tuple.should be_instance_of(Tuple) } end it 'yields only tuples with the expected header' do subject yields.each { |tuple| tuple.header.should eql(object.header) } end it 'yields only tuples with the expected data' do expect { subject }.to change { yields.dup } .from([]) .to([[1]]) end end context 'with relations having different bodies' do let(:right) { Relation.new(header, [[2]]) } it_should_behave_like 'an #each method' it 'yields only tuples' do subject yields.each { |tuple| tuple.should be_instance_of(Tuple) } end it 'yields only tuples with the expected header' do subject yields.each { |tuple| tuple.header.should eql(object.header) } end it 'yields only tuples with the expected data' do expect { subject }.to change { yields.dup } .from([]) .to([[1], [2]]) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
axiom-0.1.1 | spec/unit/axiom/algebra/union/each_spec.rb |