Sha256: c7f996231abf1d28ef6e5f050538a22d79f0772c81c9275124f6698544de70dc

Contents?: true

Size: 831 Bytes

Versions: 1

Compression:

Stored size: 831 Bytes

Contents

require 'spec_helper'

describe 'Veritas::Algebra::Rename#directions' do
  subject { object.directions }

  let(:klass)    { Algebra::Rename                               }
  let(:relation) { Relation.new([ [ :id, Integer ] ], [ [ 1 ] ]) }
  let(:object)   { klass.new(operand, :id => :other_id)          }

  context 'containing a relation' do
    let(:operand) { relation }

    it_should_behave_like 'an idempotent method'

    it { should be_kind_of(Relation::Operation::Order::DirectionSet) }

    it { should be_empty }
  end

  context 'containing an ordered relation' do
    let(:operand) { relation.order([ relation[:id] ]) }

    it_should_behave_like 'an idempotent method'

    it { should be_kind_of(Relation::Operation::Order::DirectionSet) }

    it { should == [ Attribute::Integer.new(:other_id).asc ] }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
veritas-0.0.2 spec/unit/veritas/algebra/rename/directions_spec.rb