Uniqify tags when merging dependencies

This commit is contained in:
Jack Nagel 2013-06-25 10:12:14 -05:00
parent a4988411ad
commit 783f29fccb
2 changed files with 9 additions and 1 deletions

View File

@ -100,7 +100,7 @@ class Dependency
grouped = deps.group_by(&:name)
deps.uniq.map do |dep|
tags = grouped.fetch(dep.name).map(&:tags).flatten
tags = grouped.fetch(dep.name).map(&:tags).flatten.uniq
merged_dep = dep.class.new(dep.name, tags)
merged_dep.env_proc = dep.env_proc
merged_dep

View File

@ -74,4 +74,12 @@ class DependencyExpansionTests < Test::Unit::TestCase
env_proc = @foo.env_proc = stub
assert_equal env_proc, Dependency.expand(@f).first.env_proc
end
def test_merged_tags_no_dupes
@foo2 = build_dep(:foo, ['option'])
@foo3 = build_dep(:foo, ['option'])
@deps << @foo2 << @foo3
assert_equal %w{option}, Dependency.expand(@f).first.tags
end
end