Sha256: 1aff5fbf9ca82a4255cac31654c70c4b9c89ac414df2b53ca693a2ff275e6784

Contents?: true

Size: 592 Bytes

Versions: 5

Compression:

Stored size: 592 Bytes

Contents

# frozen_string_literal: true

require "spec_helper"

module Roadie
  describe Deduplicator do
    it "removes identical pairs, keeping the last one" do
      input = [
        ["a", "1"],
        ["b", "2"],
        ["a", "3"],
        ["a", "1"]
      ]

      expect(Deduplicator.apply(input)).to eq [
        ["b", "2"],
        ["a", "3"],
        ["a", "1"]
      ]
    end

    it "returns input when no duplicates are present" do
      input = [
        ["a", "1"],
        ["a", "3"],
        ["a", "2"]
      ]

      expect(Deduplicator.apply(input)).to eq input
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
roadie-5.2.1 spec/lib/roadie/deduplicator_spec.rb
roadie-5.2.0 spec/lib/roadie/deduplicator_spec.rb
roadie-5.1.0 spec/lib/roadie/deduplicator_spec.rb
roadie-5.0.1 spec/lib/roadie/deduplicator_spec.rb
roadie-5.0.0 spec/lib/roadie/deduplicator_spec.rb