Sha256: 5a60306f55e147cce67e1e5b73093ec9c483e4c31e030e844d3ed4ef77dac4b8

Contents?: true

Size: 807 Bytes

Versions: 1

Compression:

Stored size: 807 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.0 spec/unit/axiom/algebra/rename/directions_spec.rb