Sha256: 52ba900843b6a7ee147802f750b5a5d90fbca5d2bbbe5ccf0228611fffe4fc62

Contents?: true

Size: 974 Bytes

Versions: 1

Compression:

Stored size: 974 Bytes

Contents

require 'spec_helper'

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

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

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

    specify { expect { subject }.to raise_error(InvalidHeaderError, 'the headers must be disjointed for Veritas::Algebra::Product.new') }
  end

  context 'with relations having equivalent headers' do
    let(:right) { Relation.new(header, [ [ 2 ] ]) }

    specify { expect { subject }.to raise_error(InvalidHeaderError, 'the headers must be disjointed for Veritas::Algebra::Product.new') }
  end

  context 'with relations having different headers' do
    let(:right) { Relation.new([ [ :number, Integer ] ], [ [ 2 ] ]) }

    specify { expect { subject }.to_not raise_error }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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