summaryrefslogtreecommitdiff
path: root/spec/bundler/commands/install_spec.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2023-12-23 09:08:54 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-12-23 09:34:26 +0900
commit7d7a84e99fca816ec352c95965687db240fb56d3 (patch)
tree3c734dbd75631559194ffda83695f17657320682 /spec/bundler/commands/install_spec.rb
parentfa5de8f68d51e4fbc91190061e3ce3817bd68964 (diff)
Merge RubyGems-3.5.3 and Bundler-2.5.3
Diffstat (limited to 'spec/bundler/commands/install_spec.rb')
-rw-r--r--spec/bundler/commands/install_spec.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/bundler/commands/install_spec.rb b/spec/bundler/commands/install_spec.rb
index aa7c54ce4b..7c016ff3d8 100644
--- a/spec/bundler/commands/install_spec.rb
+++ b/spec/bundler/commands/install_spec.rb
@@ -460,6 +460,35 @@ RSpec.describe "bundle install with gem sources" do
expect(the_bundle).to include_gems("rubocop 1.37.1")
end
+ it "warns when a Gemfile dependency is overriding a gemspec development dependency, with different requirements" do
+ build_lib "my-gem", path: bundled_app do |s|
+ s.add_development_dependency "rails", ">= 5"
+ end
+
+ build_repo4 do
+ build_gem "rails", "7.0.8"
+ end
+
+ gemfile <<~G
+ source "#{file_uri_for(gem_repo4)}"
+
+ gem "rails", "~> 7.0.8"
+
+ gemspec
+ G
+
+ bundle :install
+
+ expect(err).to include("A gemspec development dependency (rails, >= 5) is being overridden by a Gemfile dependency (rails, ~> 7.0.8).")
+ expect(err).to include("This behaviour may change in the future. Please remove either of them, or make sure they both have the same requirement")
+
+ # This is not the best behavior I believe, it would be better if both
+ # requirements are considered if they are compatible, and a version
+ # satisfying both is chosen. But not sure about changing it right now, so
+ # I went with a warning for the time being.
+ expect(the_bundle).to include_gems("rails 7.0.8")
+ 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"