Sha256: 4914ca0e26306100ad9fc9119923b537d2f706534078b5c74c561f469876557b
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
require 'spec_helper' describe 'Veritas::Relation::Operation::Order.new' do subject { object.new(relation, directions) } let(:header) { [ [ :id, Integer ], [ :name, String ] ] } let(:body) { [ [ 1, 'Dan Kubb' ], [ 2, 'Alex Kubb' ] ] } let(:relation) { Relation.new(header, body) } let(:object) { Relation::Operation::Order } context 'with all attributes specified in the directions' do let(:directions) { [ relation[:id], relation[:name] ] } it { should be_kind_of(object) } its(:operand) { should equal(relation) } its(:directions) { should == [ relation[:id].asc, relation[:name].asc ] } end context 'without no attributes specified in the directions' do let(:directions) { [] } it { should be_kind_of(object) } its(:operand) { should equal(relation) } its(:directions) { should == [ relation[:id].asc, relation[:name].asc ] } end context 'without all attributes specified in the directions' do let(:directions) { [ :id ] } specify { expect { subject }.to raise_error(InvalidDirectionsError, 'directions must include every attribute in the header') } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
veritas-0.0.2 | spec/unit/veritas/relation/operation/order/class_methods/new_spec.rb |