Sha256: 64ae9a20db4b63342ce7b452ab70985ab61c0d790e3efefd8dc46782a980e9be

Contents?: true

Size: 796 Bytes

Versions: 1

Compression:

Stored size: 796 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.0 spec/unit/axiom/relation/operation/order/direction_set/class_methods/new_spec.rb