Sha256: b50cad9bb3d4f00d181be8e46061042f7e269984631b44b59c25f061b991f15c

Contents?: true

Size: 597 Bytes

Versions: 1

Compression:

Stored size: 597 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

describe Relation::Operation::Order::Methods, '#sort' do
  subject { object.sort }

  let(:object)     { Relation.new(header, LazyEnumerable.new([[1], [2]]))    }
  let(:header)     { Relation::Header.coerce([[:id, Integer]])               }
  let(:directions) { Relation::Operation::Order::DirectionSet.coerce(header) }

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

  its(:directions) { should eql(directions) }

  it 'behaves the same as Array#sort_by' do
    subject.to_a.should eql(object.to_a.sort_by { |tuple| tuple[:id] })
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
axiom-0.1.1 spec/unit/axiom/relation/operation/order/methods/sort_spec.rb