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::Source::Rubygems#no_remotes?

This method is created to tell whether any remote exist in the object or not and it will be used by `Bundler:SourceList` to tell if a global source has been defined implicitly or not.

https://github.com/rubygems/rubygems/commit/47e3ff0e47
This commit is contained in:
Daniel Niknam 2021-07-24 17:21:42 +10:00 committed by Hiroshi SHIBATA
parent 095b5bbcc1
commit 91a3f06e98
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2
2 changed files with 18 additions and 0 deletions

View file

@ -71,6 +71,10 @@ module Bundler
@remotes.size > 1
end
def no_remotes?
@remotes.size == 0
end
def can_lock?(spec)
return super unless multiple_remotes?
include?(spec.source)

View file

@ -30,4 +30,18 @@ RSpec.describe Bundler::Source::Rubygems do
end
end
end
describe "#no_remotes?" do
context "when no remote provided" do
it "returns a truthy value" do
expect(described_class.new("remotes" => []).no_remotes?).to be_truthy
end
end
context "when a remote provided" do
it "returns a falsey value" do
expect(described_class.new("remotes" => ["https://rubygems.org"]).no_remotes?).to be_falsey
end
end
end
end