Sha256: 9dcde031d621b55a62dbb1643fbf562ed77a89e0682aff40be2f8b8d8bac7ae2
Contents?: true
Size: 696 Bytes
Versions: 1
Compression:
Stored size: 696 Bytes
Contents
require 'spec_helper' describe Alf::Relation, 'to_array' do let(:rel) { examples_database.query do group((project suppliers, [:city, :name]), [:name], :incity) end } let(:expected){ [ {:city => 'Athens', :incity => [ {:name => 'Adams'} ]}, {:city => 'London', :incity => [ {:name => 'Clark'}, {:name => 'Smith'} ]}, {:city => 'Paris', :incity => [ {:name => 'Blake'}, {:name => 'Jones'} ]}, ] } let(:ordering){ [:city, [:incity, :name]] } it 'recursively converts to sorted arrays' do rel.to_array(:sort => ordering).should eq(expected) end it 'is aliased as to_a' do rel.to_a(:sort => ordering).should eq(expected) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
alf-core-0.15.0 | spec/integration/relation/test_to_array.rb |