Sha256: 7068e015167a23a300e59121544f67de8df700fabc9f28a8429c483a84484e58

Contents?: true

Size: 752 Bytes

Versions: 9

Compression:

Stored size: 752 Bytes

Contents

require 'spec_helper'
module Alf
  module Engine
    describe Compact::Uniq do

      it 'should work on an empty operand' do
        Compact::Uniq.new([]).to_a.should eq([])
      end

      it 'should work when no duplicate is present' do
        rel = [
          {:name => "Jones"},
          {:name => "Smith"}
        ]
        Compact::Uniq.new(rel).to_a.should eq(rel)
      end

      it 'should work when duplicates are present' do
        rel = [
          {:name => "Jones"},
          {:name => "Smith"},
          {:name => "Jones"},
        ]
        exp = [
          {:name => "Jones"},
          {:name => "Smith"}
        ]
        Compact::Uniq.new(rel).to_a.should eq(exp)
      end

    end
  end # module Engine
end # module Alf

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
alf-core-0.15.0 spec/unit/alf-engine/compact/test_uniq.rb
alf-core-0.14.0 spec/unit/alf-engine/compact/test_uniq.rb
alf-core-0.13.1 spec/unit/alf-engine/compact/test_uniq.rb
alf-core-0.13.0 spec/unit/alf-engine/compact/test_uniq.rb
alf-0.12.2 spec/unit/alf-engine/compact/test_uniq.rb
alf-0.12.1 spec/unit/alf-engine/compact/test_uniq.rb
alf-0.12.0 spec/unit/alf-engine/compact/test_uniq.rb
alf-0.11.1 spec/unit/alf-engine/compact/test_uniq.rb
alf-0.11.0 spec/unit/alf-engine/compact/test_uniq.rb