Sha256: c3191013416f26d06874b5c9cc3d4d93ac61e31cde2567d3a4a1a23d448c5ce8
Contents?: true
Size: 1.14 KB
Versions: 2
Compression:
Stored size: 1.14 KB
Contents
require 'spec_helper' module Alf describe Keys, "select" do context 'when checking for intersection' do subject{ keys.select{|k| (k & [:name]).empty? } } let(:keys) { Keys[ [:a], [:name], [:last, :name] ] } let(:expected) { Keys[ [:a] ] } it{ should eq(expected) } end context 'when taking only empty keys' do subject{ keys.select{|k| k.empty?} } let(:keys) { Keys[ [:a], [], [], [:a, :b] ] } let(:expected) { Keys[ [] ] } it{ should eq(expected) } end context 'when checking projections' do subject{ keys.select{|k| k.project([:a], false) == k } } context 'when keys are not empty' do let(:keys){ Keys[ [:a], [:a, :name], [] ] } let(:expected){ Keys[ [:a], [] ] } it{ should eq(expected) } end context 'when keys contains only the empty key' do let(:keys){ Keys[ [] ] } let(:expected){ Keys[ [] ] } it{ should eq(expected) } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
alf-core-0.15.0 | spec/unit/alf-types/keys/test_select.rb |
alf-core-0.14.0 | spec/unit/alf-types/keys/test_select.rb |