Sha256: ae030b436187cb4798ebf563a264aae03788999689825441df3d76b0e752bd67

Contents?: true

Size: 1.2 KB

Versions: 5

Compression:

Stored size: 1.2 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe SQL::Generator::Relation::Set, '.normalize_operand_headers' do
  subject { object.normalize_operand_headers(relation) }

  let(:object)        { described_class                          }
  let(:relation)      { left.union(right)                        }
  let(:relation_name) { 'test'                                   }
  let(:header)        { [ [ :id, Integer, ], [ :name, String ] ] }
  let(:body)          { [].each                                  }

  context 'when the left and right headers are sorted in the same order' do
    let(:left)  { Relation::Base.new(relation_name, header, body) }
    let(:right) { Relation::Base.new(relation_name, header, body) }

    it { should equal(relation) }
  end

  context 'when the left and right headers are sorted in different order' do
    let(:left)  { Relation::Base.new(relation_name, header,         body) }
    let(:right) { Relation::Base.new(relation_name, header.reverse, body) }

    it { should_not equal(relation) }

    its(:right) { should_not equal(right) }

    it { should be_kind_of(relation.class) }

    its(:left) { should equal(left) }

    its(:right) { should eql(right.project(header)) }
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
axiom-sql-generator-0.1.0 spec/unit/axiom/sql/generator/relation/set/class_methods/normalize_operand_headers_spec.rb
veritas-sql-generator-0.0.7 spec/unit/veritas/sql/generator/relation/set/class_methods/normalize_operand_headers_spec.rb
veritas-sql-generator-0.0.6 spec/unit/veritas/sql/generator/relation/set/class_methods/normalize_operand_headers_spec.rb
veritas-sql-generator-0.0.5 spec/unit/veritas/sql/generator/relation/set/class_methods/normalize_operand_headers_spec.rb
veritas-sql-generator-0.0.4 spec/unit/veritas/sql/generator/relation/set/class_methods/normalize_operand_headers_spec.rb