[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 коммит произвёл Hiroshi SHIBATA
Родитель 095b5bbcc1
Коммит 91a3f06e98
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: F9CF13417264FAC2
2 изменённых файлов: 18 добавлений и 0 удалений

Просмотреть файл

@ -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)

Просмотреть файл

@ -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