Sha256: 6d6f87f3197a2fc36f12d3bcbb6f1ddf197d103c481c62a87f849cc587e55b95

Contents?: true

Size: 754 Bytes

Versions: 4

Compression:

Stored size: 754 Bytes

Contents

require 'spec_helper'
module Alf
  describe Tuple, '.project' do

    let(:type){ Tuple[name: String, status: Integer] }

    subject{ type.project(attr_list) }

    context 'with an empty attribute list' do
      let(:attr_list){ AttrList.new([]) }

      it 'projects as expected' do
        subject.should be(Tuple::EMPTY.class)
      end
    end

    context 'with an non empty attribute list' do
      let(:attr_list){ AttrList.new([:name]) }

      it 'projects as expected' do
        subject.should eq(Tuple[name: String])
      end
    end

    context 'with a full attribute list' do
      let(:attr_list){ AttrList.new([:name, :status]) }

      it 'reuses the initial instance' do
        subject.should be(type)
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
alf-core-0.15.0 spec/unit/alf-relation/tuple/factored-types/test_project.rb
alf-core-0.14.0 spec/unit/alf-relation/tuple/factored-types/test_project.rb
alf-core-0.13.1 spec/unit/alf-relation/tuple/factored-types/test_project.rb
alf-core-0.13.0 spec/unit/alf-relation/tuple/factored-types/test_project.rb