Sha256: a3e7cf969ea5c10511009276915e29a8c3c4975608ef2bd80145533e3c4d0c92

Contents?: true

Size: 724 Bytes

Versions: 9

Compression:

Stored size: 724 Bytes

Contents

require 'spec_helper'
module Alf
  module Engine
    describe Sort do

      it 'should work on an empty operand' do
        Sort.new([], Ordering[[]]).to_a.should eq([])
      end

      it 'should work with ascending' do
        rel = [
          {:name => "Jones"},
          {:name => "Smith"}
        ]
        Sort.new(rel, Ordering[[:name, :asc]]).to_a.should eq(rel)
      end

      it 'should work with descending' do
        rel = [
          {:name => "Jones"},
          {:name => "Smith"}
        ]
        exp = [
          {:name => "Smith"},
          {:name => "Jones"}
        ]
        Sort.new(rel, Ordering[[:name, :desc]]).to_a.should eq(exp)
      end

    end
  end # module Engine
end # module Alf

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
alf-core-0.15.0 spec/unit/alf-engine/test_sort.rb
alf-core-0.14.0 spec/unit/alf-engine/test_sort.rb
alf-core-0.13.1 spec/unit/alf-engine/test_sort.rb
alf-core-0.13.0 spec/unit/alf-engine/test_sort.rb
alf-0.12.2 spec/unit/alf-engine/test_sort.rb
alf-0.12.1 spec/unit/alf-engine/test_sort.rb
alf-0.12.0 spec/unit/alf-engine/test_sort.rb
alf-0.11.1 spec/unit/alf-engine/test_sort.rb
alf-0.11.0 spec/unit/alf-engine/test_sort.rb