Skip to content

Commit

Permalink
Merge pull request #85 from razum2um/master
Browse files Browse the repository at this point in the history
Do not write duplicate sources in the Gemfile.
  • Loading branch information
sikachu committed Feb 6, 2015
2 parents d715462 + f0de312 commit cf2bea3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/appraisal/gemfile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def gemspec(options = {})
protected

def source_entry
@sources.map { |source| "source #{source.inspect}" }.join("\n")
@sources.uniq.map { |source| "source #{source.inspect}" }.join("\n")
end

def ruby_version_entry
Expand Down
7 changes: 7 additions & 0 deletions spec/appraisal/gemfile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
expect(gemfile.to_s.strip).to eq %{source "one"\nsource "two"}
end

it "ignores duplicate sources" do
gemfile = Appraisal::Gemfile.new
gemfile.source "one"
gemfile.source "one"
expect(gemfile.to_s.strip).to eq %{source "one"}
end

it "preserves dependency order" do
gemfile = Appraisal::Gemfile.new
gemfile.gem "one"
Expand Down

0 comments on commit cf2bea3

Please sign in to comment.