spec/unit/axiom/algebra/join/each_spec.rb in axiom-0.1.0 vs spec/unit/axiom/algebra/join/each_spec.rb in axiom-0.1.1

- old
+ new

@@ -3,16 +3,16 @@ require 'spec_helper' describe Algebra::Join, '#each' do subject { object.each { |tuple| yields << tuple } } - let(:object) { described_class.new(left, right) } - let(:left) { Relation.new([ [ :id, Integer ] ], [ [ 1 ], [ 2 ] ]) } - let(:yields) { [] } + let(:object) { described_class.new(left, right) } + let(:left) { Relation.new([[:id, Integer]], [[1], [2]]) } + let(:yields) { [] } context 'when the attributes are joined' do - let(:right) { Relation.new([ [ :id, Integer ], [ :name, String ] ], [ [ 2, 'Dan Kubb' ] ]) } + let(:right) { Relation.new([[:id, Integer], [:name, String]], [[2, 'Dan Kubb']]) } it_should_behave_like 'an #each method' it 'yields only tuples' do subject @@ -23,18 +23,18 @@ subject yields.each { |tuple| tuple.header.should be(object.header) } end it 'yields only tuples with the expected data' do - expect { subject }.to change { yields.dup }. - from([]). - to([ [ 2, 'Dan Kubb' ] ]) + expect { subject }.to change { yields.dup } + .from([]) + .to([[2, 'Dan Kubb']]) end end context 'when the attributes are disjoint' do - let(:right) { Relation.new([ [ :name, String ] ], [ [ 'Dan Kubb' ] ]) } + let(:right) { Relation.new([[:name, String]], [['Dan Kubb']]) } it_should_behave_like 'an #each method' it 'yields only tuples' do subject @@ -45,18 +45,18 @@ subject yields.each { |tuple| tuple.header.should be(object.header) } end it 'yields only tuples with the expected data' do - expect { subject }.to change { yields.dup }. - from([]). - to([ [ 1, 'Dan Kubb' ], [ 2, 'Dan Kubb' ] ]) + expect { subject }.to change { yields.dup } + .from([]) + .to([[1, 'Dan Kubb'], [2, 'Dan Kubb']]) end end context 'when the attributes are an intersection' do - let(:right) { Relation.new([ [ :id, Integer ] ], [ [ 1 ] ]) } + let(:right) { Relation.new([[:id, Integer]], [[1]]) } it_should_behave_like 'an #each method' it 'yields only tuples' do subject @@ -67,11 +67,11 @@ subject yields.each { |tuple| tuple.header.should be(object.header) } end it 'yields only tuples with the expected data' do - expect { subject }.to change { yields.dup }. - from([]). - to([ [ 1 ] ]) + expect { subject }.to change { yields.dup } + .from([]) + .to([[1]]) end end end