Sha256: 570c9b19c02bc6731a97821e067c597e2910d2768c385e7c39df6bf3aed2fd35

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

# encoding: utf-8

require 'spec_helper'

describe Relation::Materialized, '.new' do
  let(:header) { Relation::Header.coerce([[:id, Integer]]) }
  let(:tuples) { [[1]]                                     }
  let(:object) { described_class                           }

  context 'with directions' do
    subject { object.new(header, tuples, directions) }

    let(:directions) { [header[:id]] }

    it { should be_instance_of(object) }

    its(:header) { should be(header) }

    its(:directions) do
      should be_instance_of(Relation::Operation::Order::DirectionSet)
      should == directions
    end

    it { should == tuples }
  end

  context 'with no directions' do
    subject { object.new(header, tuples) }

    it { should be_instance_of(object) }

    its(:header) { should be(header) }

    its(:directions) { should be(Relation::Operation::Order::DirectionSet::EMPTY) }

    it { should == tuples }
  end

  context 'with no tuples or directions' do
    subject { object.new(header) }

    it { should be_instance_of(object) }

    its(:header) { should be(header) }

    its(:directions) { should be(Relation::Operation::Order::DirectionSet::EMPTY) }

    it { should be_empty }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
axiom-0.1.1 spec/unit/axiom/relation/materialized/class_methods/new_spec.rb