Sha256: a725d01937578b00d006e6a82bfec61fc551a5f999ce5a173026e1db1d18bdb7

Contents?: true

Size: 764 Bytes

Versions: 9

Compression:

Stored size: 764 Bytes

Contents

require 'spec_helper'
module Alf
  module Engine
    describe Sort::InMemory do

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

      it 'should work with ascending' do
        rel = [
          {:name => "Jones"},
          {:name => "Smith"}
        ]
        Sort::InMemory.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::InMemory.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/sort/test_in_memory.rb
alf-core-0.14.0 spec/unit/alf-engine/sort/test_in_memory.rb
alf-core-0.13.1 spec/unit/alf-engine/sort/test_in_memory.rb
alf-core-0.13.0 spec/unit/alf-engine/sort/test_in_memory.rb
alf-0.12.2 spec/unit/alf-engine/sort/test_in_memory.rb
alf-0.12.1 spec/unit/alf-engine/sort/test_in_memory.rb
alf-0.12.0 spec/unit/alf-engine/sort/test_in_memory.rb
alf-0.11.1 spec/unit/alf-engine/sort/test_in_memory.rb
alf-0.11.0 spec/unit/alf-engine/sort/test_in_memory.rb