Sha256: 57212c6a204b5fe2a7d01fc6338e660fbe00f171d8702bb26ad74f43235eb4f9

Contents?: true

Size: 1015 Bytes

Versions: 4

Compression:

Stored size: 1015 Bytes

Contents

require 'spec_helper'
module Alf
  describe AttrList, "project" do

    let(:list){ AttrList.new [:id, :name, :status] }

    context '--no-allbut' do
      subject{ list.project(subset) }

      context 'on a proper subset' do
        let(:subset){ [:id, :name] }

        it { should eq(AttrList[:id, :name]) }
      end

      context 'on an empty subset' do
        let(:subset){ [] }

        it{ should eq(AttrList[]) }
      end

      context 'on the same set' do
        let(:subset){ list }

        it{ should eq(list) }
      end
    end

    context '--allbut' do
      subject{ list.project(subset, true) }

      context 'on a proper subset' do
        let(:subset){ [:id, :name] }

        it{ should eq(AttrList[:status]) }
      end

      context 'on an empty subset' do
        let(:subset){ [] }

        it { should eq(AttrList[:id, :name, :status]) }
      end

      context 'on the same set' do
        let(:subset){ list }

        it{ should eq(AttrList[]) }
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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