1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] Implement Bundler::SourceList#implicit_global_source?

This method is created to tell whether any global source exist in the object or not and it will be used by `Bundler:Dsl` to print a warning if no global source has been defined in the Gemfile.

https://github.com/rubygems/rubygems/commit/422fec4438
This commit is contained in:
Daniel Niknam 2021-07-24 17:25:08 +10:00 committed by Hiroshi SHIBATA
parent 91a3f06e98
commit b500e8fab4
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2
2 changed files with 19 additions and 0 deletions

View file

@ -37,6 +37,10 @@ module Bundler
global_rubygems_source.multiple_remotes?
end
def implicit_global_source?
global_rubygems_source.no_remotes?
end
def add_path_source(options = {})
if options["gemspec"]
add_source_to_list Source::Gemspec.new(options), path_sources

View file

@ -441,4 +441,19 @@ RSpec.describe Bundler::SourceList do
source_list.remote!
end
end
describe "implicit_global_source?" do
context "when a global rubygem source provided" do
it "returns a falsy value" do
source_list.add_global_rubygems_remote("https://rubygems.org")
expect(source_list.implicit_global_source?).to be_falsey
end
end
context "when no global rubygem source provided" do
it "returns a truthy value" do
expect(source_list.implicit_global_source?).to be_truthy
end
end
end
end