Sha256: 74c2ebd27a1d069dc253ea8f520353c921479e94d95c2b7ef3c9304fc119f0ef

Contents?: true

Size: 706 Bytes

Versions: 1

Compression:

Stored size: 706 Bytes

Contents

require 'spec_helper'

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

  let(:klass)    { Algebra::Projection                                         }
  let(:body)     { [ [ 1, 'Dan Kubb' ], [ 2, 'Dan Kubb' ], [ 2, 'Alex Kubb'] ] }
  let(:relation) { Relation.new([ [ :id, Integer ], [ :name, String ] ], body) }
  let(:object)   { klass.new(relation, [ :id ])                                }
  let(:yields)   { []                                                          }

  it_should_behave_like 'a command method'

  it 'yields each tuple' do
    expect { subject }.to change { yields.dup }.
      from([]).
      to([ [ 1 ], [ 2 ] ])
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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