Sha256: 60975562c53524671b7b0ea6c02adf9254606d242ae88e4cc6e66cd42938fdba

Contents?: true

Size: 718 Bytes

Versions: 1

Compression:

Stored size: 718 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: ->(tuple) { 1 } } }

    it { should be_instance_of(object) }
  end

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

    specify { expect { subject }.to raise_error(DuplicateNameError, 'duplicate names: [:id, :name]') }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
axiom-0.1.1 spec/unit/axiom/algebra/extension/class_methods/new_spec.rb