Sha256: 15a004498875983d575a9cb3a6c05f810cb254ce44ca347cb2661de4acec4ef3

Contents?: true

Size: 758 Bytes

Versions: 1

Compression:

Stored size: 758 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Algebra::Extension, '.new' do
  subject { object.new(operand, extensions) }

  let(:operand) { Relation.new([ [ :id, Integer ], [ :name, String ] ], [ [ 1, 'Dan Kubb' ], [ 2, 'Dan Kubb' ] ]) }
  let(:object)  { described_class                                                                                 }

  context 'with a unique attribute name provided' do
    let(:extensions) { { :unique => lambda { |tuple| 1 } } }

    it { should be_kind_of(object) }
  end

  context 'with a duplicate attribute name provided' do
    let(:extensions) { { :id => proc {}, :name => proc {} } }

    specify { expect { subject }.to raise_error(DuplicateAttributeError, 'duplicate attributes: id, name') }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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