Sha256: 0c4ce999126af9c43c52709a15f22c5f1eeb271d57428ac094a3abf571ab1e8a

Contents?: true

Size: 636 Bytes

Versions: 4

Compression:

Stored size: 636 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

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

  it_should_behave_like 'an #each method'

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
veritas-0.0.7 spec/unit/veritas/algebra/projection/each_spec.rb
veritas-0.0.6 spec/unit/veritas/algebra/projection/each_spec.rb
veritas-0.0.5 spec/unit/veritas/algebra/projection/each_spec.rb
veritas-0.0.4 spec/unit/veritas/algebra/projection/each_spec.rb