Sha256: b5e0318a5909b9617f18792999b646395a9e88d67ff07464e4c3949c2a437348

Contents?: true

Size: 868 Bytes

Versions: 1

Compression:

Stored size: 868 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Relation::Operation::Combination, '.combine_tuples' do
  subject { object.combine_tuples(header, left_tuple, right_tuples) { |tuple| yields << tuple } }

  let(:left_header)  { Relation::Header.coerce([ [ :id,   Integer ] ] ) }
  let(:right_header) { Relation::Header.coerce([ [ :name, String  ] ] ) }
  let(:left_tuple)   { Tuple.new(left_header,  [ 1 ])                   }
  let(:right_tuples) { [ Tuple.new(right_header, [ 'Dan Kubb' ]) ]      }
  let(:header)       { left_header | right_header                       }
  let(:object)       { self.class.described_class                       }
  let(:yields)       { []                                               }

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
axiom-0.1.0 spec/unit/axiom/relation/operation/combination/class_methods/combine_tuples_spec.rb