Sha256: bb180857e3ffa92b4a0e837415ffb1f0d1e899d2f4ce81f4c68cfea96f7f1a67

Contents?: true

Size: 1.19 KB

Versions: 4

Compression:

Stored size: 1.19 KB

Contents

require 'spec_helper'
module Alf
  describe AttrList, 'superset?' do

    context 'when equal' do
      let(:left){ AttrList[:id, :name] }
      let(:right){ AttrList[:name, :id] }

      it 'returns true if non proper' do
        left.superset?(right).should be_true
      end
      it 'returns false if proper' do
        left.superset?(right, true).should be_false
      end
    end

    context 'when both empty' do
      let(:left){ AttrList[] }
      let(:right){ AttrList[] }

      it 'returns true if non proper' do
        left.superset?(right).should be_true
      end
      it 'returns false if proper' do
        left.superset?(right, true).should be_false
      end
    end

    context 'when disjoint' do
      let(:left){ AttrList[:status] }
      let(:right){ AttrList[:name, :id] }

      it 'returns false' do
        left.superset?(right).should be_false
        left.superset?(right, true).should be_false
      end
    end

    context 'when a proper supserset' do
      let(:left){ AttrList[:id, :name] }
      let(:right){ AttrList[:name] }

      it 'returns true' do
        left.superset?(right).should be_true
        left.superset?(right, true).should be_true
      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_superset.rb
alf-core-0.14.0 spec/unit/alf-types/attr_list/test_superset.rb
alf-core-0.13.1 spec/unit/alf-types/attr_list/test_superset.rb
alf-core-0.13.0 spec/unit/alf-types/attr_list/test_superset.rb