spec/unit/veritas/algebra/difference/each_spec.rb in veritas-0.0.2 vs spec/unit/veritas/algebra/difference/each_spec.rb in veritas-0.0.3

- old
+ new

@@ -1,29 +1,28 @@ require 'spec_helper' -describe 'Veritas::Algebra::Difference#each' do +describe Algebra::Difference, '#each' do subject { object.each { |tuple| yields << tuple } } - let(:klass) { Algebra::Difference } - let(:header) { [ [ :id, Integer ] ] } - let(:left) { Relation.new(header, [ [ 1 ] ]) } - let(:object) { klass.new(left, right) } - let(:yields) { [] } + let(:header) { [ [ :id, Integer ] ] } + let(:left) { Relation.new(header, [ [ 1 ] ]) } + let(:object) { described_class.new(left, right) } + let(:yields) { [] } context 'with relations having similar bodies' do let(:right) { left.dup } - it_should_behave_like 'a command method' + it_should_behave_like 'an #each method' it 'yields no tuples' do expect { subject }.to_not change { yields.dup } end end context 'with relations having different bodies' do let(:right) { Relation.new(header, [ [ 2 ] ]) } - it_should_behave_like 'a command method' + it_should_behave_like 'an #each method' it 'yields each tuple' do expect { subject }.to change { yields.dup }. from([]). to([ [ 1 ] ])