Sha256: 3685dd556e3d9ebd1537eacbd94a37bba431d3b092b5fc64779c0598f39fa291

Contents?: true

Size: 861 Bytes

Versions: 1

Compression:

Stored size: 861 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Relation::Operation::Combination, '.combine_tuples' do
  subject do
    object.combine_tuples(
      header,
      left_tuple,
      right_tuples,
      &yields.method(:<<)
    )
  end

  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.1 spec/unit/axiom/relation/operation/combination/class_methods/combine_tuples_spec.rb