Sha256: 352558a7ba94d9fae872490b44423533c3e099cb339e6c85820d0f0e71bcecfd

Contents?: true

Size: 885 Bytes

Versions: 1

Compression:

Stored size: 885 Bytes

Contents

require 'spec_helper'

describe 'Veritas::Algebra::Intersection#each' do
  subject { object.each { |tuple| yields << tuple } }

  let(:klass)  { Algebra::Intersection           }
  let(:header) { [ [ :id, Integer ] ]            }
  let(:left)   { Relation.new(header, [ [ 1 ] ]) }
  let(:yields) { []                              }
  let(:object) { klass.new(left, right)          }

  context 'with relations having similar bodies' do
    let(:right) { left.dup }

    it_should_behave_like 'a command method'

    it 'yields each tuple' 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 'a command method'

    it 'yields each tuple' do
      expect { subject }.to_not change { yields.dup }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
veritas-0.0.2 spec/unit/veritas/algebra/intersection/each_spec.rb