Sha256: 779054c36413dc6d556a6235ee6ac80b0c8f9e476550cecfa174817c0b63fba1
Contents?: true
Size: 1.54 KB
Versions: 1
Compression:
Stored size: 1.54 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Relation::Operation::Order::DirectionSet, '#sort_tuples' do subject { object.sort_tuples(relation) } let(:header) { [ [ :id, Integer ], [ :name, String ] ] } let(:body) { [ [ 1, 'Dan Kubb' ], [ 2, 'Alex Kubb' ], [ 2, 'Dan Kubb' ] ] } let(:relation) { Relation.new(header, body) } let(:object) { described_class.new(header) } context 'sorted with ascending id and descending name' do let(:object) { described_class.new([ relation[:id].asc, relation[:name].desc ]) } it { should be_kind_of(Array) } it { should == [ [ 1, 'Dan Kubb' ], [ 2, 'Dan Kubb' ], [ 2, 'Alex Kubb' ] ] } end context 'sorted with ascending id and ascending name' do let(:object) { described_class.new([ relation[:id].asc, relation[:name].asc ]) } it { should be_kind_of(Array) } it { should == [ [ 1, 'Dan Kubb' ], [ 2, 'Alex Kubb' ], [ 2, 'Dan Kubb' ] ] } end context 'sorted with descending id and ascending name' do let(:object) { described_class.new([ relation[:id].desc, relation[:name].asc ]) } it { should be_kind_of(Array) } it { should == [ [ 2, 'Alex Kubb' ], [ 2, 'Dan Kubb' ], [ 1, 'Dan Kubb' ] ] } end context 'sorted with descending id and descending name' do let(:object) { described_class.new([ relation[:id].desc, relation[:name].desc ]) } it { should be_kind_of(Array) } it { should == [ [ 2, 'Dan Kubb' ], [ 2, 'Alex Kubb' ], [ 1, 'Dan Kubb' ] ] } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
veritas-0.0.4 | spec/unit/veritas/relation/operation/order/direction_set/sort_tuples_spec.rb |