Sha256: 3086b6f682929c8a3111f80a307002eca6c9a6e997de7172754774937f04a18a

Contents?: true

Size: 885 Bytes

Versions: 1

Compression:

Stored size: 885 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

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

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

    it { should be_kind_of(object) }
  end

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

    it { should be_kind_of(object) }
  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') }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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