Sha256: bc55d2d29870b54e7be37467001e1caaf5fee4f2aa41c81fda75b5d7d9475fe1

Contents?: true

Size: 795 Bytes

Versions: 1

Compression:

Stored size: 795 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

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

  let(:relation) { Relation.new([[:id, Integer]], LazyEnumerable.new) }
  let(:object)   { described_class.new(operand, id: :other_id)        }

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

    it_should_behave_like 'an idempotent method'

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

    it { should be_empty }
  end

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

    it_should_behave_like 'an idempotent method'

    it { should be_instance_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
axiom-0.1.1 spec/unit/axiom/algebra/rename/directions_spec.rb