summaryrefslogtreecommitdiff
path: root/spec/bundler/commands
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2023-12-01 16:56:17 +0100
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-12-05 14:28:42 +0900
commit16669cd6ad737a99782655084fabf444f7dc93eb (patch)
tree317d512c7a63484e02694b9cbbcb32e5c8bc745b /spec/bundler/commands
parent7ab877761e0577b1cd29811173971305bfadcead (diff)
[rubygems/rubygems] Fix crash when duplicating a dev dependency in Gemfile & gemspec
https://github.com/rubygems/rubygems/commit/e78c0a4a48
Diffstat (limited to 'spec/bundler/commands')
-rw-r--r--spec/bundler/commands/install_spec.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/bundler/commands/install_spec.rb b/spec/bundler/commands/install_spec.rb
index bed24f0618..d570bac44a 100644
--- a/spec/bundler/commands/install_spec.rb
+++ b/spec/bundler/commands/install_spec.rb
@@ -460,6 +460,41 @@ RSpec.describe "bundle install with gem sources" do
expect(the_bundle).to include_gems("rubocop 1.37.1")
end
+ it "does not warn if a gem is added once in Gemfile and also inside a gemspec as a development dependency, with same requirements, and different sources" do
+ build_lib "my-gem", :path => bundled_app do |s|
+ s.add_development_dependency "activesupport"
+ end
+
+ build_repo4 do
+ build_gem "activesupport"
+ end
+
+ build_git "activesupport", "1.0", :path => lib_path("activesupport")
+
+ install_gemfile <<~G
+ source "#{file_uri_for(gem_repo4)}"
+
+ gemspec
+
+ gem "activesupport", :git => "#{file_uri_for(lib_path("activesupport"))}"
+ G
+
+ expect(err).to be_empty
+ expect(the_bundle).to include_gems "activesupport 1.0", :source => "git@#{lib_path("activesupport")}"
+
+ # if the Gemfile dependency is specified first
+ install_gemfile <<~G
+ source "#{file_uri_for(gem_repo4)}"
+
+ gem "activesupport", :git => "#{file_uri_for(lib_path("activesupport"))}"
+
+ gemspec
+ G
+
+ expect(err).to be_empty
+ expect(the_bundle).to include_gems "activesupport 1.0", :source => "git@#{lib_path("activesupport")}"
+ end
+
it "considers both dependencies for resolution if a gem is added once in Gemfile and also inside a local gemspec as a runtime dependency, with different requirements" do
build_lib "my-gem", :path => bundled_app do |s|
s.add_dependency "rubocop", "~> 1.36.0"