Sha256: 64091c7725a7d4f29227994a03505e18ca745d26e9201f95f83f076bdf1271b2

Contents?: true

Size: 792 Bytes

Versions: 1

Compression:

Stored size: 792 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Relation::Operation::Order::DirectionSet, '.new' do
  subject { object.new(argument) }

  let(:id)     { Attribute::Integer.new(:id).asc  }
  let(:name)   { Attribute::String.new(:name).asc }
  let(:age)    { Attribute::Integer.new(:age).asc }
  let(:object) { described_class                  }

  context 'with an argument that responds to #to_ary and do not contain duplicates' do
    let(:argument) { [id, name] }

    it { should be_instance_of(object) }

    it { should == argument }
  end

  context 'with an argument that responds to #to_ary and contain duplicates' do
    let(:argument) { [id, id, name, name, age] }

    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/relation/operation/order/direction_set/class_methods/new_spec.rb