diff --git a/bundler/lib/bundler/source_list.rb b/bundler/lib/bundler/source_list.rb index 113d49ba7201..c7dfa3d79746 100644 --- a/bundler/lib/bundler/source_list.rb +++ b/bundler/lib/bundler/source_list.rb @@ -37,6 +37,10 @@ def aggregate_global_source? 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 diff --git a/bundler/spec/bundler/source_list_spec.rb b/bundler/spec/bundler/source_list_spec.rb index c2d1978b29ec..f860e9ff58e7 100644 --- a/bundler/spec/bundler/source_list_spec.rb +++ b/bundler/spec/bundler/source_list_spec.rb @@ -441,4 +441,19 @@ 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