Skip to content

Commit 441b9db

Browse files
committed
use set for sources
1 parent d715462 commit 441b9db

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/appraisal/gemfile.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Gemfile
1111
attr_reader :dependencies
1212

1313
def initialize
14-
@sources = []
14+
@sources = Set.new
1515
@ruby_version = nil
1616
@dependencies = DependencyList.new
1717
@gemspec = nil

spec/appraisal/gemfile_spec.rb

+9-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,15 @@
1414
gemfile = Appraisal::Gemfile.new
1515
gemfile.source "one"
1616
gemfile.source "two"
17-
expect(gemfile.to_s.strip).to eq %{source "one"\nsource "two"}
17+
expect(gemfile.to_s.strip).to match %r{source "one"}
18+
expect(gemfile.to_s.strip).to match %r{source "two"}
19+
end
20+
21+
it "ignores duplicate sources" do
22+
gemfile = Appraisal::Gemfile.new
23+
gemfile.source "one"
24+
gemfile.source "one"
25+
expect(gemfile.to_s.strip).to eq %{source "one"}
1826
end
1927

2028
it "preserves dependency order" do

0 commit comments

Comments
 (0)