Skip to content

Commit f0de312

Browse files
committed
remove duplicate sources
1 parent d715462 commit f0de312

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/appraisal/gemfile.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def gemspec(options = {})
9797
protected
9898

9999
def source_entry
100-
@sources.map { |source| "source #{source.inspect}" }.join("\n")
100+
@sources.uniq.map { |source| "source #{source.inspect}" }.join("\n")
101101
end
102102

103103
def ruby_version_entry

spec/appraisal/gemfile_spec.rb

+7
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@
1717
expect(gemfile.to_s.strip).to eq %{source "one"\nsource "two"}
1818
end
1919

20+
it "ignores duplicate sources" do
21+
gemfile = Appraisal::Gemfile.new
22+
gemfile.source "one"
23+
gemfile.source "one"
24+
expect(gemfile.to_s.strip).to eq %{source "one"}
25+
end
26+
2027
it "preserves dependency order" do
2128
gemfile = Appraisal::Gemfile.new
2229
gemfile.gem "one"

0 commit comments

Comments
 (0)