Sha256: cd6e40b6ba3727cc0e4f2fbbc1918e2e407454f3eb212c7acf81f8cb63c18706
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
# encoding: utf-8 require 'spec_helper' describe Relation::Operation::Reverse, '.new' do subject { object.new(relation) } let(:original_relation) { Relation.new([[:id, Integer]], [[1], [2]]) } let(:object) { described_class } context 'with an ordered relation' do let(:relation) { original_relation.sort_by { |r| r.id } } it { should be_instance_of(object) } it 'reverses the directions' do subject.directions.should eql(relation.directions.reverse) end end context 'with an ordered relation having an empty header' do let(:relation) { original_relation.sort_by { |r| r.id }.project([]) } it { should be_instance_of(object) } it 'reverses the directions' do subject.directions.should eql(relation.directions.reverse) end end context 'without an ordered relation' do let(:relation) { original_relation } specify { expect { subject }.to raise_error(OrderedRelationRequiredError, 'can only reverse an ordered operand') } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
axiom-0.1.1 | spec/unit/axiom/relation/operation/reverse/class_methods/new_spec.rb |