Sha256: 4c7f7460515d3238b134f59050d39d82a0da4cfcd5b84c17ef57a92e8882f7cc

Contents?: true

Size: 887 Bytes

Versions: 1

Compression:

Stored size: 887 Bytes

Contents

require 'spec_helper'

describe 'Veritas::Algebra::Join.new' do
  subject { Algebra::Join.new(left, right) }

  let(:header) { [ [ :id, Integer ] ]                   }
  let(:left)   { Relation.new(header, [ [ 1 ], [ 2 ] ]) }

  context 'with relations having headers with common attributes' do
    let(:right) { Relation.new([ [ :id, Integer ], [ :name, String ] ], [ [ 2, 'Dan Kubb' ] ]) }

    specify { expect { subject }.to_not raise_error }
  end

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

    specify { expect { subject }.to_not raise_error }
  end

  context 'with relations having different headers' do
    let(:right) { Relation.new([ [ :name, String ] ], [ [ 'Dan Kubb' ] ]) }

    specify { expect { subject }.to raise_error(InvalidHeaderError, 'the headers must have common attributes for Veritas::Algebra::Join.new') }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
veritas-0.0.1 spec/unit/veritas/algebra/join/class_methods/new_spec.rb