summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorEarlopain <14981592+Earlopain@users.noreply.github.com>2024-06-18 18:38:08 +0200
committergit <svn-admin@ruby-lang.org>2024-06-18 17:53:59 +0000
commitb8a592fe6e2d1b537b229625cd3d439a7d5a6eb5 (patch)
tree30dfd0d5e64f75fbd27cfcedc953c23420a6d418 /spec
parent4b04da1ee81c460c591456d8d24792af55cd5c5f (diff)
[rubygems/rubygems] Fix `bundle fund` when the gemfile contains optional groups
`current_dependencies` doesn't return gems in optional groups, while `specs` would Closes https://github.com/rubygems/rubygems/pull/7757 https://github.com/rubygems/rubygems/commit/c797e95636
Diffstat (limited to 'spec')
-rw-r--r--spec/bundler/commands/fund_spec.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/bundler/commands/fund_spec.rb b/spec/bundler/commands/fund_spec.rb
index 5415b88eeb..cc32a7242f 100644
--- a/spec/bundler/commands/fund_spec.rb
+++ b/spec/bundler/commands/fund_spec.rb
@@ -55,6 +55,42 @@ RSpec.describe "bundle fund" do
expect(out).to_not include("gem_with_dependent_funding")
end
+ it "does not consider fund information for uninstalled optional dependencies" do
+ install_gemfile <<-G
+ source "#{file_uri_for(gem_repo2)}"
+ group :whatever, optional: true do
+ gem 'has_funding_and_other_metadata'
+ end
+ gem 'has_funding'
+ gem 'rack-obama'
+ G
+
+ bundle "fund"
+
+ expect(out).to include("* has_funding (1.2.3)\n Funding: https://example.com/has_funding/funding")
+ expect(out).to_not include("has_funding_and_other_metadata")
+ expect(out).to_not include("rack-obama")
+ end
+
+ it "considers fund information for installed optional dependencies" do
+ bundle "config set with whatever"
+
+ install_gemfile <<-G
+ source "#{file_uri_for(gem_repo2)}"
+ group :whatever, optional: true do
+ gem 'has_funding_and_other_metadata'
+ end
+ gem 'has_funding'
+ gem 'rack-obama'
+ G
+
+ bundle "fund"
+
+ expect(out).to include("* has_funding_and_other_metadata (1.0)\n Funding: https://example.com/has_funding_and_other_metadata/funding")
+ expect(out).to include("* has_funding (1.2.3)\n Funding: https://example.com/has_funding/funding")
+ expect(out).to_not include("rack-obama")
+ end
+
it "prints message if none of the gems have fund information" do
install_gemfile <<-G
source "#{file_uri_for(gem_repo2)}"